소스정리

main
이범준 1 year ago
parent 3e42b62497
commit 56e415581f

@ -6,7 +6,9 @@ import java.io.FileInputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Path; import java.nio.file.Path;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -39,9 +41,19 @@ public class AttachedTxtParser extends LayoutParser{
dataObject.put("FILE_PATH", filePath); dataObject.put("FILE_PATH", filePath);
String fileName = file.getName(); String fileName = file.getName();
dataObject.put("FILE_NAME", fileName); dataObject.put("FILE_NAME", fileName);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd / HH:mm:ss");
dataObject.put("FILE_LAST_MODIFIED", sdf.format(new Date(file.lastModified())));
dataObject.put("FILE_SIZE", file.length()+" byte");
String fileExtension = FilenameUtils.getExtension(fileName); String fileExtension = FilenameUtils.getExtension(fileName);
dataObject.put("FILE_EXTENSION", fileExtension); dataObject.put("FILE_EXTENSION", fileExtension);
boolean isUserUpload = file.compareTo(new File(descriptor.getLinkFileLocation()+File.separator+fileName)) == 0;
if(!isUserUpload) {
dataObject.put("LINK_ENT_NM", descriptor.getLinkEnterpriseName());
}
boolean isMetaData = fileExtension.toUpperCase().equals("TXT"); boolean isMetaData = fileExtension.toUpperCase().equals("TXT");
String[] fileNameSplit = FilenameUtils.removeExtension(fileName).split(Matcher.quoteReplacement("_")); String[] fileNameSplit = FilenameUtils.removeExtension(fileName).split(Matcher.quoteReplacement("_"));
@ -102,7 +114,7 @@ public class AttachedTxtParser extends LayoutParser{
} }
} }
dataObject.put("TEMP_GROUP_ID", tempGroupSeq); dataObject.put("TEMP_GROUP_ID", tempGroupSeq);
dataObject.put("ENT_TYPE", "xit");
dataObjectList.add(dataObject); dataObjectList.add(dataObject);
before = dataObject; before = dataObject;
}); });

@ -82,4 +82,8 @@ public class LayoutDescriptor {
*/ */
private String secondSeperatorStarterItems; private String secondSeperatorStarterItems;
/**
*
*/
private String linkEnterpriseName;
} }

@ -46,6 +46,11 @@ public class OnlyImageParser extends LayoutParser {
String extension = FilenameUtils.getExtension(fileName); String extension = FilenameUtils.getExtension(fileName);
dataObject.put("FILE_EXTENSION", extension); dataObject.put("FILE_EXTENSION", extension);
boolean isUserUpload = file.compareTo(new File(descriptor.getLinkFileLocation()+File.separator+fileName)) == 0;
if(!isUserUpload) {
dataObject.put("LINK_ENT_NM", descriptor.getLinkEnterpriseName());
}
String[] fileNameSplit = FilenameUtils.removeExtension(fileName).split(Matcher.quoteReplacement("_")); String[] fileNameSplit = FilenameUtils.removeExtension(fileName).split(Matcher.quoteReplacement("_"));
dataObject.put("DEVICE_ID", fileNameSplit[0]); dataObject.put("DEVICE_ID", fileNameSplit[0]);
@ -96,7 +101,7 @@ public class OnlyImageParser extends LayoutParser {
} }
dataObject.put("TEMP_GROUP_ID", tempGroupSeq); dataObject.put("TEMP_GROUP_ID", tempGroupSeq);
dataObject.put("ENT_TYPE", "ino");
dataObjectList.add(dataObject); dataObjectList.add(dataObject);
before = dataObject; before = dataObject;
}); });

@ -7,10 +7,12 @@ import java.io.InputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Base64; import java.util.Base64;
import java.util.Base64.Decoder; import java.util.Base64.Decoder;
import java.util.Base64.Encoder; import java.util.Base64.Encoder;
import java.util.Date;
import java.util.List; import java.util.List;
import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.FileInfo;
@ -36,6 +38,17 @@ public class SingleFileParser extends LayoutParser {
String fileName = file.getName(); String fileName = file.getName();
dataObject.put("FILE_NAME", fileName); dataObject.put("FILE_NAME", fileName);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd / HH:mm:ss");
dataObject.put("FILE_LAST_MODIFIED", sdf.format(new Date(file.lastModified())));
dataObject.put("FILE_SIZE", file.length()+" byte");
dataObject.put("FILE_EXTENSION","");
boolean isUserUpload = file.compareTo(new File(descriptor.getLinkFileLocation()+File.separator+fileName)) == 0;
if(!isUserUpload) {
dataObject.put("LINK_ENT_NM", descriptor.getLinkEnterpriseName());
}
//파일내용 //파일내용
String fileCn0 = ""; String fileCn0 = "";
try { try {
@ -78,7 +91,6 @@ public class SingleFileParser extends LayoutParser {
dataObject.put("TRAFFIC_LIGHT_TYPE", CmmnUtil.substringByBytes(fileCn, 113, 113)); //신호등종류(미사용) dataObject.put("TRAFFIC_LIGHT_TYPE", CmmnUtil.substringByBytes(fileCn, 113, 113)); //신호등종류(미사용)
dataObject.put("SOME", CmmnUtil.substringByBytes(fileCn, 113, 113)); //?(미사용) dataObject.put("SOME", CmmnUtil.substringByBytes(fileCn, 113, 113)); //?(미사용)
String fileAreaText = fileCn0.substring(114); String fileAreaText = fileCn0.substring(114);
Encoder encoder = Base64.getEncoder(); Encoder encoder = Base64.getEncoder();
@ -127,7 +139,6 @@ public class SingleFileParser extends LayoutParser {
dataObject.put("TEMP_GROUP_ID", tempGroupSeq); dataObject.put("TEMP_GROUP_ID", tempGroupSeq);
tempGroupSeq++; tempGroupSeq++;
dataObject.put("ENT_TYPE", "hitecom");
dataObjectList.add(dataObject); dataObjectList.add(dataObject);
}); });

@ -110,9 +110,9 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
DataObject linkFileInfo = endData; DataObject linkFileInfo = endData;
String entType = linkFileInfo.string("ENT_TYPE"); String entType = linkFileInfo.string("LINK_ENT_NM");
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11"); if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
if(entType.equals("knl")) crdn.setCrdnInptSeCd("12"); else if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
else crdn.setCrdnInptSeCd("15"); else crdn.setCrdnInptSeCd("15");
crdn.setCrdnInptSeCd("11"); crdn.setCrdnInptSeCd("11");
@ -155,9 +155,9 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
} }
} }
String entType = metaFileInfo.string("ENT_TYPE"); String entType = metaFileInfo.string("LINK_ENT_NM");
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11"); if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
if(entType.equals("knl")) crdn.setCrdnInptSeCd("12"); else if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
else crdn.setCrdnInptSeCd("15"); else crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01"); crdn.setVltnCd("01");
@ -207,11 +207,12 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
} }
DataObject linkFileInfo = linkFileInfoList.get(0); DataObject linkFileInfo = linkFileInfoList.get(0);
String entType = linkFileInfo.string("ENT_TYPE"); String entType = linkFileInfo.string("LINK_ENT_NM");
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11"); if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
if(entType.equals("knl")) crdn.setCrdnInptSeCd("12"); else if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
else crdn.setCrdnInptSeCd("15"); else crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01"); crdn.setVltnCd("01");
crdn.setCrdnSeCd("07"); crdn.setCrdnSeCd("07");

@ -233,7 +233,7 @@ public class Crdn05Controller extends ApplicationController {
*/ */
public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) { public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) {
ModelAndView mav = new ModelAndView("jsonView"); ModelAndView mav = new ModelAndView("jsonView");
List<DataObject> parsedDataList = new ArrayList<DataObject>(); List<DataObject> allParsedDataList = new ArrayList<DataObject>();
String taskSeCd = hReq.getParameter("taskSeCd"); String taskSeCd = hReq.getParameter("taskSeCd");
String institute = currentUser().getInstitute(); String institute = currentUser().getInstitute();
@ -264,12 +264,15 @@ public class Crdn05Controller extends ApplicationController {
case "BIN": parser = new SingleFileParser(); break; case "BIN": parser = new SingleFileParser(); break;
} }
parser.setDescriptor(layoutDescriptors.get(i));
if(!fileList.isEmpty()) { if(!fileList.isEmpty()) {
parsedDataList.addAll(parser.parsing(fileList)); List<DataObject> parsedDataList = parser.parsing(fileList);
allParsedDataList.addAll(parsedDataList);
} }
} }
mav = setCollectionInfo(mav, parsedDataList, ""); mav = setCollectionInfo(mav, allParsedDataList, "");
return mav; return mav;
} }

@ -18,6 +18,7 @@
<result property="contentSeperator" column="DATA_SE_TYPE1" /> <!-- 자료 구분 유형1 --> <result property="contentSeperator" column="DATA_SE_TYPE1" /> <!-- 자료 구분 유형1 -->
<result property="contentSecondSeperator" column="DATA_SE_TYPE2" /> <!-- 자료 구분 유형2 --> <result property="contentSecondSeperator" column="DATA_SE_TYPE2" /> <!-- 자료 구분 유형2 -->
<result property="secondSeperatorStarterItems" column="DATA_LAYOUT2" /> <!-- 자료 형식2 --> <result property="secondSeperatorStarterItems" column="DATA_LAYOUT2" /> <!-- 자료 형식2 -->
<result property="linkEnterpriseName" column="LINK_ENT_NM" /> <!-- 연계 업체 명 -->
</resultMap> </resultMap>
<select id="selectBasicAmt" parameterType="cokr.xit.fims.crdn.CrdnQuery" resultType="string"> <select id="selectBasicAmt" parameterType="cokr.xit.fims.crdn.CrdnQuery" resultType="string">
@ -60,32 +61,34 @@ SELECT CONCAT(A.EMD_NM,
<select id="selectLinkFileLayoutMetadata" parameterType="map" resultMap="descriptorRow"> <select id="selectLinkFileLayoutMetadata" parameterType="map" resultMap="descriptorRow">
/* 연계파일 레이아웃 정보 조회(globalStngMapper.selectLinkFileLayoutMetadata) */ /* 연계파일 레이아웃 정보 조회(globalStngMapper.selectLinkFileLayoutMetadata) */
SELECT FILE_LAYOUT_ID SELECT A.FILE_LAYOUT_ID
, SGG_CD , A.SGG_CD
, TASK_SE_CD , A.TASK_SE_CD
, INST_CD , A.INST_CD
, DEPT_CD , A.DEPT_CD
, DATA_FILE_SE , A.DATA_FILE_SE
, FILE_NM_SZ , A.FILE_NM_SZ
, FILE_SE_TYPE , A.FILE_SE_TYPE
, FILE_NM_LAYOUT , A.FILE_NM_LAYOUT
, DATA_SE_TYPE1 , A.DATA_SE_TYPE1
, DATA_LAYOUT1 , A.DATA_LAYOUT1
, DATA_SE_TYPE2 , A.DATA_SE_TYPE2
, DATA_LAYOUT2 , A.DATA_LAYOUT2
, FILE_TNOCS , A.FILE_TNOCS
, LINK_FILE_PATH , A.LINK_FILE_PATH
FROM TB_CRDN_FILE_LAYOUT , B.LINK_ENT_NM
WHERE USE_YN = 'Y' FROM TB_CRDN_FILE_LAYOUT A
LEFT OUTER JOIN TB_FTP_INFO B ON (A.FILE_LAYOUT_ID = B.FILE_LAYOUT_ID)
WHERE A.USE_YN = 'Y'
<choose> <choose>
<when test="fileLayoutId != null and fileLayoutId != '' "> <when test="fileLayoutId != null and fileLayoutId != '' ">
AND FILE_LAYOUT_ID = #{fileLayoutId} AND A.FILE_LAYOUT_ID = #{fileLayoutId}
</when> </when>
<otherwise> <otherwise>
AND SGG_CD = #{sggCd} AND A.SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd} AND A.TASK_SE_CD = #{taskSeCd}
AND INST_CD = #{instCd} AND A.INST_CD = #{instCd}
AND DEPT_CD = #{deptCd} AND A.DEPT_CD = #{deptCd}
</otherwise> </otherwise>
</choose> </choose>

Loading…
Cancel
Save