PDF 자료 추출 설정 저장 기능 추가

main
이범준 9 months ago
parent 90d8b005a2
commit 1a467292b5

@ -0,0 +1,22 @@
package cokr.xit.fims.cmmn;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ExtrArtclStng extends AbstractEntity {
private String extrFormId; //추출항목ID
private String extrArtclNm; //추출항목명
private String extrArtclDscrp; //추출항목설명
private String leftPstn; //좌측 위치
private String topPstn; //상단 위치
private String widthSz; //영역크기 길이
private String heightSz; //영역크기 높이
private String otptArtclOrdr; //출력항목순서
private String sggCd;
private String taskSeCd;
private String tmplatId;
}

@ -0,0 +1,19 @@
package cokr.xit.fims.cmmn;
import java.util.List;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ExtrForm extends AbstractEntity {
private String extrBscId;
private String sggCd;
private String taskSeCd;
private String tmplatId;
private String mobilePageTmplt;
private List<ExtrArtclStng> extrArtclStngList;
private String[] extrFormIDs;
}

@ -4,6 +4,8 @@ import java.util.List;
import org.egovframe.rte.psl.dataaccess.mapper.Mapper;
import cokr.xit.fims.cmmn.ExtrArtclStng;
import cokr.xit.fims.cmmn.ExtrForm;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.foundation.component.AbstractMapper;
import cokr.xit.foundation.data.DataObject;
@ -11,8 +13,27 @@ import cokr.xit.foundation.data.DataObject;
@Mapper("extrStngMapper")
public interface ExtrStngMapper extends AbstractMapper {
/** 릿 .<br />
* @param query
* @return 릿
*/
DataObject selectExtrBscStng(ExtrStngQuery extrStngQuery);
int insertBscStng(ExtrForm extrForm);
int updateBscStng(ExtrForm extrForm);
/** .<br />
* @param query
* @return
*/
List<DataObject> selectExtrArtclStngList(ExtrStngQuery extrStngQuery);
DataObject selectExtrBscStng(ExtrStngQuery extrStngQuery);
int updateArtclStng(ExtrArtclStng update);
int deleteArtclStng(ExtrForm extrForm);
int insertArtclStng(ExtrArtclStng insert);
}

@ -9,6 +9,8 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Component;
import cokr.xit.fims.cmmn.ExtrArtclStng;
import cokr.xit.fims.cmmn.ExtrForm;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.dao.ExtrStngMapper;
import cokr.xit.fims.cmmn.pdf.extration.PredefinedSet;
@ -37,7 +39,7 @@ public class ExtrStngBean extends AbstractComponent {
* @return
*/
public Map<String, Object> getExtrArtclStngMap(ExtrStngQuery query){
Map<String,Object> otptStngMap = new HashMap<String,Object>();
Map<String,Object> extrStngMap = new HashMap<String,Object>();
PDFExtractFormat pdfFormat = null;
pdfFormat = new ElectronicNotice();
@ -59,9 +61,70 @@ public class ExtrStngBean extends AbstractComponent {
Map<String, Object> custom = new HashMap<String,Object>();
custom.put("dataList", customDataList);
otptStngMap.put("predefinedSetList", predefinedSetList);
otptStngMap.put("predefined", predefined);
otptStngMap.put("custom", custom);
return otptStngMap;
extrStngMap.put("predefinedSetList", predefinedSetList);
extrStngMap.put("predefined", predefined);
extrStngMap.put("custom", custom);
return extrStngMap;
}
public boolean saveExtrBscStng(ExtrForm extrForm) {
boolean result = false;
String userId = currentUser().getId();
if(ifEmpty(extrForm.getExtrBscId(), ()-> "").equals("")) {
extrForm.setCreatedBy(userId);
result = extrStngMapper.insertBscStng(extrForm) == 1 ? true : false;
} else {
extrForm.setModifiedBy(userId);
result = extrStngMapper.updateBscStng(extrForm) == 1 ? true : false;
}
return result;
}
public boolean saveExtrArtclStng(ExtrForm extrForm) {
try {
String userId = currentUser().getId();
List<ExtrArtclStng> extrArtclStngList = extrForm.getExtrArtclStngList();
List<String> updateKeyList = new ArrayList<String>();
List<ExtrArtclStng> insertList = new ArrayList<ExtrArtclStng>();
if(extrArtclStngList != null && !extrArtclStngList.isEmpty()) {
List<ExtrArtclStng> updateList = extrArtclStngList.stream().filter(item -> !ifEmpty(item.getExtrFormId(), () -> "").equals("")).toList();
if(!updateList.isEmpty()) {
for(ExtrArtclStng update : updateList) {
update.setModifiedBy(userId);
int u = extrStngMapper.updateArtclStng(update);
updateKeyList.add(update.getExtrFormId());
}
}
insertList = extrArtclStngList.stream().filter(item -> ifEmpty(item.getExtrFormId(), () -> "").equals("")).toList();
}
if(!updateKeyList.isEmpty()) {
extrForm.setExtrFormIDs(updateKeyList.toArray(new String[updateKeyList.size()]));
}
extrForm.setModifiedBy(userId);
int d = extrStngMapper.deleteArtclStng(extrForm);
if(!insertList.isEmpty()) {
for(ExtrArtclStng insert : insertList) {
insert.setCreatedBy(userId);
int i = extrStngMapper.insertArtclStng(insert);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("[F]추출 설정 저장 중 오류가 발생하였습니다.");
}
return true;
}
}

@ -14,6 +14,7 @@ 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.ExtrForm;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.OtptForm;
import cokr.xit.fims.cmmn.OtptStngQuery;
@ -251,4 +252,20 @@ public class StngController extends ApplicationController {
return mav;
}
/** PDF .
* @return
*/
public ModelAndView saveExtrStngInfo(ExtrForm extrForm) {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
saved = extrStngBean.saveExtrBscStng(extrForm);
if(saved) {
saved = extrStngBean.saveExtrArtclStng(extrForm);
}
mav.addObject("saved", saved);
return mav;
}
}

@ -8,6 +8,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.fims.cmmn.CmmnQuery;
import cokr.xit.fims.cmmn.ExtrForm;
import cokr.xit.fims.cmmn.ExtrStngQuery;
import cokr.xit.fims.cmmn.OtptForm;
import cokr.xit.fims.cmmn.OtptStngQuery;
@ -733,5 +734,11 @@ public class CmnController {
public ModelAndView getExtrStngInfo(ExtrStngQuery extrStngQuery) {
return super.getExtrStngInfo(extrStngQuery);
}
@Override
@RequestMapping(name="PDF 자료 추출 설정 정보 저장", value=METHOD_URL.saveExtrStngInfo)
public ModelAndView saveExtrStngInfo(ExtrForm extrForm) {
return super.saveExtrStngInfo(extrForm);
}
}
}

@ -2,8 +2,53 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.cmmn.dao.ExtrStngMapper">
<select id="selectExtrBscStng" parameterType="cokr.xit.fims.cmmn.ExtrStngQuery" resultType="dataobject">
/* 추출 기본 설정 조회(extrStngMapper.selectExtrBscStng) */
SELECT EXTR_BSC_ID
, SGG_CD
, TASK_SE_CD
, MOBILE_PAGE_TMPLT
FROM TB_EXTR_BSC_STNG
WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND TMPLAT_ID = #{tmplatId}
</select>
<insert id="insertBscStng" parameterType="cokr.xit.fims.cmmn.ExtrForm">
/* PDF 자료 추출 템플릿 문구 설정 등록(extrStngMapper.insertBscStng) */
<selectKey resultType="string" keyProperty="extrBscId" keyColumn="NEW_ID" order="BEFORE">
SELECT
LPAD(CAST(IFNULL(MAX(EXTR_BSC_ID) + 1, 1) AS INT), 10, '0')
AS NEW_ID
FROM TB_EXTR_BSC_STNG
</selectKey>
INSERT
INTO TB_EXTR_BSC_STNG (
EXTR_BSC_ID
, SGG_CD
, TASK_SE_CD
, MOBILE_PAGE_TMPLT
, USE_YN
) VALUES (
#{extrBscId}
, #{sggCd}
, #{taskSeCd}
, #{mobilePageTmplt}
, 'Y'
)
</insert>
<update id="updateBscStng" parameterType="cokr.xit.fims.cmmn.ExtrForm">
/* PDF 자료 추출 템플릿 문구 수정(extrStngMapper.updateBscStng) */
UPDATE TB_EXTR_BSC_STNG
SET MOBILE_PAGE_TMPLT = #{mobilePageTmplt}
WHERE EXTR_BSC_ID = #{extrBscId}
AND USE_YN = 'Y'
</update>
<select id="selectExtrArtclStngList" parameterType="cokr.xit.fims.cmmn.ExtrStngQuery" resultType="dataobject">
/* 추출 항목 설정 조회(otptStngMapper.selectExtrArtclStngList) */
/* 추출 항목 설정 조회(extrStngMapper.selectExtrArtclStngList) */
SELECT EXTR_FORM_ID
, SGG_CD
, TASK_SE_CD
@ -21,17 +66,66 @@ SELECT EXTR_FORM_ID
AND TMPLAT_ID = #{tmplatId}
</select>
<select id="selectExtrBscStng" parameterType="cokr.xit.fims.cmmn.ExtrStngQuery" resultType="dataobject">
/* 추출 기본 설정 조회(otptStngMapper.selectExtrBscStng) */
SELECT EXTR_BSC_ID
<insert id="insertArtclStng" parameterType="cokr.xit.fims.cmmn.ExtrArtclStng">
/* 추출 설정 등록(extrStngMapper.insertArtclStng) */
<selectKey resultType="string" keyProperty="extrFormId" keyColumn="NEW_ID" order="BEFORE">
SELECT
LPAD(CAST(IFNULL(MAX(EXTR_FORM_ID) + 1, 1) AS INT), 10, '0')
AS NEW_ID
FROM TB_EXTR_FORM_STNG
</selectKey>
INSERT
INTO TB_EXTR_FORM_STNG (
EXTR_FORM_ID
, SGG_CD
, TASK_SE_CD
, MOBILE_PAGE_TMPLT
FROM TB_EXTR_BSC_STNG
WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd}
, TMPLAT_ID
, EXTR_ARTCL_NM
, EXTR_ARTCL_DSCRP
, LEFT_PSTN
, TOP_PSTN
, WIDTH_SZ
, HEIGHT_SZ
, USE_YN
) VALUES (
#{extrFormId}
, #{sggCd}
, #{taskSeCd}
, #{tmplatId}
, #{extrArtclNm}
, #{extrArtclDscrp}
, #{leftPstn}
, #{topPstn}
, #{widthSz}
, #{heightSz}
, 'Y'
)
</insert>
<update id="updateArtclStng" parameterType="cokr.xit.fims.cmmn.ExtrArtclStng">
/* 추출 설정 수정(extrStngMapper.updateArtclStng) */
UPDATE TB_EXTR_FORM_STNG
SET EXTR_ARTCL_NM = #{extrArtclNm}
, EXTR_ARTCL_DSCRP= #{extrArtclDscrp}
, LEFT_PSTN = #{leftPstn}
, TOP_PSTN = #{topPstn}
, WIDTH_SZ = #{widthSz}
, HEIGHT_SZ = #{heightSz}
WHERE EXTR_FORM_ID = #{extrFormId}
AND USE_YN = 'Y'
</update>
<update id="deleteArtclStng" parameterType="cokr.xit.fims.cmmn.ExtrForm">
/* 추출 설정 삭제(extrStngMapper.deleteArtclStng) */
UPDATE TB_EXTR_FORM_STNG
SET USE_YN = 'N'
WHERE SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND TMPLAT_ID = #{tmplatId}
</select>
AND USE_YN = 'Y'
<if test='extrFormIDs != null'>
AND EXTR_FORM_ID NOT IN (<foreach collection="extrFormIDs" item="EXTR_FORM_ID" separator=",">#{EXTR_FORM_ID}</foreach>)
</if>
</update>
</mapper>

@ -386,8 +386,6 @@ $(document).ready(function(){
return;
}
//TODO : 삭제 불가 항목 확인
$("#"+tbodyId).find("tr").filter(function(index, selector){
if($(selector).find("input[name='del'][type='checkbox']").is(":checked")){
$(selector).remove();

Loading…
Cancel
Save