단속연계파일 레이아웃 조회 sql 추가

main
이범준 1 year ago
parent 445fa10751
commit a9eb6d2346

@ -54,6 +54,8 @@ public class CrdnQuery extends CmmnQuery {
private String crdnSttsCd;
private String ansSeCd;
private String ansRsnCd;
private String instCd;
private String deptCd;
//포함, 제외, 특정 자료
private String schOnlySamePlace;
@ -340,6 +342,24 @@ public class CrdnQuery extends CmmnQuery {
return self();
}
public String getInstCd() {
return ifEmpty(instCd, () -> null);
}
public <T extends CrdnQuery> T setInstCd(String instCd) {
this.instCd = instCd;
return self();
}
public String getDeptCd() {
return ifEmpty(deptCd, () -> null);
}
public <T extends CrdnQuery> T setDeptCd(String deptCd) {
this.deptCd = deptCd;
return self();
}
public String getAplcnYmd() {
return ifEmpty(aplcnYmd, () -> null);
}

@ -22,4 +22,5 @@ public interface CrdnTeamMapper extends AbstractMapper {
* @return
*/
DataObject selectTeamInfo(String teamId);
}

@ -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.crdn.parsing.LayoutDescriptor;
import cokr.xit.foundation.component.AbstractMapper;
@Mapper("globalStngMapper")
@ -37,4 +38,11 @@ public interface GlobalStngMapper extends AbstractMapper {
String sggCd = selectSggCd(currentUser().getInstitute());
return selectStdgNmList(sggCd);
};
/** .
* @param query
* @return
*/
List<LayoutDescriptor> selectLinkFileLayoutMetadata(CrdnQuery query);
}

@ -16,7 +16,7 @@ import org.apache.commons.io.FilenameUtils;
import cokr.xit.foundation.data.DataObject;
public class AttachedTxtParser implements LayoutParser{
public class AttachedTxtParser extends LayoutParser{
private DataObject before = new DataObject();
private int tempGroupSeq = 1;

@ -7,34 +7,79 @@ import lombok.Setter;
@Setter
public class LayoutDescriptor {
/**
* ID
*/
private String fileLayoutId;
/**
*
*/
private String sggCd;
/**
*
*/
private String taskSeCd;
/**
*
*/
private String instCd;
/**
*
*/
private String deptCd;
/**
*
*/
private String linkFileLocation;
/**
*
*/
private String fileGroup;
/**
*
*/
private String countPerFileGroup;
/**
*
*/
private String fileNameLength;
/**
*
*/
private String fileNameItmes;
/**
*
*/
private String fileNameSeperator;
/**
*
*/
private String contentItems;
/**
*
*/
private String contentSeperator;
/**
* 2
*/
private String contentSecondSeperator;
/**
* 2
*/
private String secondSeperatorStarterItems;
}

@ -0,0 +1,14 @@
package cokr.xit.fims.crdn.parsing;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Stream;
public class LayoutDiscriminator {
public static LayoutDescriptor choice(Stream<Path> fileList, List<LayoutDescriptor> candidates) {
// TODO
return null;
}
}

@ -6,18 +6,24 @@ import java.util.stream.Stream;
import cokr.xit.foundation.data.DataObject;
public interface LayoutParser {
abstract public class LayoutParser {
LayoutDescriptor descriptor = new LayoutDescriptor();
public void setDescriptor(LayoutDescriptor descriptor) {
this.descriptor = descriptor;
}
/** .<br />
* @param fileList
* @return
*/
public List<DataObject> parsing(Stream<Path> fileList);
abstract public List<DataObject> parsing(Stream<Path> fileList);
/** .<br />
* @param currentItem , beforeItem
* @return
*/
public boolean isChangeCrackdown(DataObject currentItem, DataObject beforeItem);
abstract public boolean isChangeCrackdown(DataObject currentItem, DataObject beforeItem);
}

@ -15,7 +15,7 @@ import org.apache.commons.io.FilenameUtils;
import cokr.xit.foundation.data.DataObject;
public class OnlyImageParser implements LayoutParser {
public class OnlyImageParser extends LayoutParser {
private DataObject before = new DataObject();
private int tempGroupSeq = 1;

@ -18,7 +18,7 @@ import cokr.xit.base.file.FileInfo;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.foundation.data.DataObject;
public class SingleFileParser implements LayoutParser {
public class SingleFileParser extends LayoutParser {
private int tempGroupSeq = 1;

@ -3,6 +3,7 @@ package cokr.xit.fims.crdn.service;
import java.util.List;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.parsing.LayoutDescriptor;
import cokr.xit.foundation.data.DataObject;
public interface CrdnStngService {
@ -18,4 +19,10 @@ public interface CrdnStngService {
* @return
*/
DataObject getTeamInfo(String teamId);
/** .
* @param sggCd , taskSeCd , instCd , deptCd
* @return
*/
List<LayoutDescriptor> getLinkFileLayoutMetadata(String sggCd, String taskSeCd, String instCd, String deptCd);
}

@ -12,6 +12,7 @@ import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.CrdnTeamMapper;
import cokr.xit.fims.crdn.dao.ExmptnVhclMapper;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.crdn.parsing.LayoutDescriptor;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
@ -216,4 +217,12 @@ public class CrdnStngBean extends AbstractComponent {
return crdnTeamMapper.selectTeamInfo(teamId);
}
/** .
* @param query
* @return
*/
public List<LayoutDescriptor> getLinkFileLayoutMetadata(CrdnQuery query) {
return globalStngMapper.selectLinkFileLayoutMetadata(query);
}
}

@ -7,6 +7,7 @@ import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.parsing.LayoutDescriptor;
import cokr.xit.fims.crdn.service.CrdnStngService;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
@ -27,4 +28,14 @@ public class CrdnStngServiceBean extends AbstractServiceBean implements CrdnStng
return crdnStngBean.selectTeamInfo(teamId);
}
@Override
public List<LayoutDescriptor> getLinkFileLayoutMetadata(String sggCd, String taskSeCd, String instCd, String deptCd) {
CrdnQuery query = new CrdnQuery();
query.setSggCd(sggCd);
query.setTaskSeCd(taskSeCd);
query.setInstCd(instCd);
query.setDeptCd(deptCd);
return crdnStngBean.getLinkFileLayoutMetadata(query);
}
}

@ -20,6 +20,8 @@ import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.FileInfo;
import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.cmmn.ftp.FTPUtil;
import cokr.xit.fims.cmmn.ftp.RemoteSystemInfo;
@ -27,11 +29,13 @@ import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.CrdnInstMapper;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.crdn.parsing.AttachedTxtParser;
import cokr.xit.fims.crdn.parsing.LayoutDescriptor;
import cokr.xit.fims.crdn.parsing.LayoutDiscriminator;
import cokr.xit.fims.crdn.parsing.LayoutParser;
import cokr.xit.fims.crdn.parsing.SingleFileParser;
import cokr.xit.fims.crdn.parsing.OnlyImageParser;
import cokr.xit.fims.crdn.parsing.ParsingUtil;
import cokr.xit.fims.crdn.parsing.AttachedTxtParser;
import cokr.xit.fims.crdn.parsing.SingleFileParser;
import cokr.xit.fims.crdn.service.CrdnService;
import cokr.xit.fims.crdn.service.CrdnStngService;
import cokr.xit.fims.crdn.service.ImportService;
@ -77,6 +81,9 @@ public class Crdn05Controller extends ApplicationController {
@Resource(name="globalStngMapper")
protected GlobalStngMapper globalStngMapper;
@Resource(name="userMapper")
protected UserMapper userMapper;
/** .
* @return fims/crdn/crdn05010-main
*/
@ -129,12 +136,12 @@ public class Crdn05Controller extends ApplicationController {
boolean saved = false;
String entType = hReq.getParameter("entType");
LayoutParser enterprise = null;
LayoutParser parser = null;
switch(entType){
case "ino": enterprise = new OnlyImageParser(); break;
case "ino": parser = new OnlyImageParser(); break;
//case "knl": break;
case "hitecom": enterprise = new SingleFileParser(); break;
case "xit": enterprise = new AttachedTxtParser(); break;
case "hitecom": parser = new SingleFileParser(); break;
case "xit": parser = new AttachedTxtParser(); break;
//case "": enterprise = new (); break;
}
@ -185,12 +192,12 @@ public class Crdn05Controller extends ApplicationController {
boolean saved = false;
String entType = hReq.getParameter("entType");
LayoutParser enterprise = null;
LayoutParser parser = null;
switch(entType){
case "ino": enterprise = new OnlyImageParser(); break;
case "ino": parser = new OnlyImageParser(); break;
//case "knl": break;
case "hitecom": enterprise = new SingleFileParser(); break;
case "xit": enterprise = new AttachedTxtParser(); break;
case "hitecom": parser = new SingleFileParser(); break;
case "xit": parser = new AttachedTxtParser(); break;
//case "": enterprise = new (); break;
}
@ -224,16 +231,17 @@ public class Crdn05Controller extends ApplicationController {
ModelAndView mav = new ModelAndView("jsonView");
String entType = hReq.getParameter("entType");
LayoutParser enterprise = null;
LayoutParser parser = null;
switch(entType){
case "ino": enterprise = new OnlyImageParser(); break;
case "ino": parser = new OnlyImageParser(); break;
//case "knl": break;
case "hitecom": enterprise = new SingleFileParser(); break;
case "xit": enterprise = new AttachedTxtParser(); break;
case "hitecom": parser = new SingleFileParser(); break;
case "xit": parser = new AttachedTxtParser(); break;
//case "": enterprise = new (); break;
}
String institute = currentUser().getInstitute();
String taskSeCd = hReq.getParameter("taskSeCd");
String equipmentType = hReq.getParameter("equipmentType");
@ -247,7 +255,20 @@ public class Crdn05Controller extends ApplicationController {
e.printStackTrace();
}
List<DataObject> dataObjectList = enterprise.parsing(fileList);
String sggCd = globalStngMapper.selectSggCdForCurrentUser();
ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), institute);
String deptCd = currentUser.getDeptCode();
List<LayoutDescriptor> candidates = crdnStngService.getLinkFileLayoutMetadata(sggCd, taskSeCd, institute, deptCd);
if(candidates == null || candidates.isEmpty()) {
throw new RuntimeException("연계파일 레이아웃 정보 조회에 실패하였습니다.");
} else if(candidates.size() == 1) {
parser.setDescriptor(candidates.get(0));
} else {
parser.setDescriptor(LayoutDiscriminator.choice(fileList, candidates));
}
List<DataObject> dataObjectList = parser.parsing(fileList);
mav = setCollectionInfo(mav, dataObjectList, "");
return mav;
}

@ -2,6 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.fims.crdn.dao.GlobalStngMapper">
<resultMap id="descriptorRow" type="cokr.xit.fims.crdn.parsing.LayoutDescriptor">
<result property="fileLayoutId" column="FILE_LAYOUT_ID" /> <!-- 파일 레이아웃 ID -->
<result property="sggCd" column="SGG_CD" /> <!-- 시군구 코드 -->
<result property="taskSeCd" column="TASK_SE_CD" /> <!-- 업무 구분 코드 -->
<result property="instCd" column="INST_CD" /> <!-- 기관 코드 -->
<result property="deptCd" column="DEPT_CD" /> <!-- 부서 코드 -->
<result property="linkFileLocation" column="LINK_FILE_PATH" /> <!-- 연계 파일 경로 -->
<result property="fileGroup" column="DATA_FILE_SE" /> <!-- 자료 파일 구분 -->
<result property="countPerFileGroup" column="FILE_TNOCS" /> <!-- 파일 총 건수 -->
<result property="fileNameLength" column="FILE_NM_SZ" /> <!-- 파일 명 크기 -->
<result property="fileNameItmes" column="FILE_NM_LAYOUT" /> <!-- 파일 명 형식 -->
<result property="fileNameSeperator" column="FILE_SE_TYPE" /> <!-- 파일 구분 유형 -->
<result property="contentItems" column="DATA_LAYOUT1" /> <!-- 자료 형식1 -->
<result property="contentSeperator" column="DATA_SE_TYPE1" /> <!-- 자료 구분 유형1 -->
<result property="contentSecondSeperator" column="DATA_SE_TYPE2" /> <!-- 자료 구분 유형2 -->
<result property="secondSeperatorStarterItems" column="DATA_LAYOUT2" /> <!-- 자료 형식2 -->
</resultMap>
<select id="selectBasicAmt" parameterType="cokr.xit.fims.crdn.CrdnQuery" resultType="string">
/* 기본금액 조회(globalStngMapper.selectBasicAmt) */
SELECT AMT
@ -40,4 +58,29 @@ SELECT CONCAT(A.EMD_NM,
ORDER BY A.EMD_NM, A.LI_NM
</select>
<select id="selectLinkFileLayoutMetadata" parameterType="map" resultMap="descriptorRow">
/* 연계파일 레이아웃 정보 조회(crdnTeamMapper.selectLinkFileLayoutMetadata) */
SELECT FILE_LAYOUT_ID
, SGG_CD
, TASK_SE_CD
, INST_CD
, DEPT_CD
, DATA_FILE_SE
, FILE_NM_SZ
, FILE_SE_TYPE
, FILE_NM_LAYOUT
, DATA_SE_TYPE1
, DATA_LAYOUT1
, DATA_SE_TYPE2
, DATA_LAYOUT2
, FILE_TNOCS
, LINK_FILE_PATH
FROM TB_CRDN_FILE_LAYOUT
WHERE USE_YN = 'Y'
AND SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND INST_CD = #{instCd}
AND DEPT_CD = #{deptCd}
</select>
</mapper>

@ -22,6 +22,7 @@
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end">장비업체</label>
<select id="entType--${pageName}" name="entType" class="form-select">
<option value="">선택하세요</option>
<option value="xit">XIT권장포맷</option>
<c:if test="${taskSeCd == 'DPV' or taskSeCd == 'ECA'}">
<option value="knl">KNL</option>
<option value="ino">이노</option>
@ -29,7 +30,6 @@
<c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV'}">
<option value="gasan">가산정보통신</option>
<option value="elisoft">엘리소프트</option>
<option value="xit">XIT권장포맷</option>
<option value="hitecom">하이테콤</option>
</c:if>
<c:if test="${taskSeCd == '미세먼지'}">

Loading…
Cancel
Save