단속연계파일 등록시 업체 선택하는 부분 제거

main
이범준 1 year ago
parent ffec84c997
commit 3e42b62497

@ -30,6 +30,7 @@ public class CrdnQuery extends CmmnQuery {
private String[] crdnIDs;
private String amtDcsnCdGroupId;
private String dtlAmtDcsnCdGroupId;
private String fileLayoutId;
//날짜
private String aplcnYmd;
@ -396,6 +397,15 @@ public class CrdnQuery extends CmmnQuery {
return self();
}
public String getFileLayoutId() {
return ifEmpty(fileLayoutId, () -> null);
}
public <T extends CrdnQuery> T setFileLayoutId(String fileLayoutId) {
this.fileLayoutId = fileLayoutId;
return self();
}
public String getDtlAmtDcsnCd() {
return ifEmpty(dtlAmtDcsnCd, () -> null);
}

@ -7,6 +7,7 @@ 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;
import cokr.xit.foundation.data.DataObject;
@Mapper("globalStngMapper")
public interface GlobalStngMapper extends AbstractMapper {
@ -45,4 +46,10 @@ public interface GlobalStngMapper extends AbstractMapper {
* @return
*/
List<LayoutDescriptor> selectLinkFileLayoutMetadata(CrdnQuery query);
/** ftp .
* @param fileLayoutId ID
* @return ftp
*/
DataObject selectRemoteInfo(String fileLayoutId);
}

@ -10,7 +10,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.io.FilenameUtils;
@ -22,10 +21,10 @@ public class AttachedTxtParser extends LayoutParser{
private int tempGroupSeq = 1;
@Override
public List<DataObject> parsing(Stream<Path> fileList) {
public List<DataObject> parsing(List<Path> fileList) {
//파일명으로 정렬(파싱 전)
List<Path> sortedFileList = fileList
List<Path> sortedFileList = fileList.stream()
.sorted((item1, item2) -> item1.toFile().getName().compareTo(item2.toFile().getName()))
.collect(Collectors.toList());
@ -33,6 +32,8 @@ public class AttachedTxtParser extends LayoutParser{
sortedFileList.forEach(item -> {
DataObject dataObject = new DataObject();
dataObject.put("FILE_GROUP_TYPE", "TXT");
File file = item.toFile();
String filePath = file.getPath();
dataObject.put("FILE_PATH", filePath);

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

@ -2,7 +2,6 @@ package cokr.xit.fims.crdn.parsing;
import java.nio.file.Path;
import java.util.List;
import java.util.stream.Stream;
import cokr.xit.foundation.data.DataObject;
@ -18,7 +17,7 @@ abstract public class LayoutParser {
* @param fileList
* @return
*/
abstract public List<DataObject> parsing(Stream<Path> fileList);
abstract public List<DataObject> parsing(List<Path> fileList);
/** .<br />
* @param currentItem , beforeItem

@ -8,7 +8,6 @@ import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.apache.commons.io.FilenameUtils;
@ -21,17 +20,19 @@ public class OnlyImageParser extends LayoutParser {
private int tempGroupSeq = 1;
@Override
public List<DataObject> parsing(Stream<Path> fileList) {
public List<DataObject> parsing(List<Path> fileList) {
List<DataObject> dataObjectList = new ArrayList<>();
//파일명으로 정렬(파싱 전)
List<Path> sortedFileList = fileList
List<Path> sortedFileList = fileList.stream()
.sorted((item1, item2) -> item1.toFile().getName().compareTo(item2.toFile().getName()))
.collect(Collectors.toList());
sortedFileList.forEach(item -> {
DataObject dataObject = new DataObject();
dataObject.put("FILE_GROUP_TYPE", "JPG");
File file = item.toFile();
String filePath = file.getPath();
dataObject.put("FILE_PATH", filePath);

@ -1,28 +0,0 @@
package cokr.xit.fims.crdn.parsing;
import java.io.File;
public class ParsingUtil {
/**,,, .<br />
* @param institute , taskSeCd , entType , equipmentType
* @return
*/
public static String getWorkDirectoryPath(String institute, String taskSeCd, String entType, String equipmentType) {
String workPath = "";
if(entType.equals("ino")) {
workPath = "files"+File.separator+"tempForIno";
}
if(entType.equals("knl")) {
workPath = "files"+File.separator+"tempForKnl";
}
if(entType.equals("hitecom")) {
workPath = "files"+File.separator+"tempForHitecom";
}
if(entType.equals("xit")) {
workPath = "files"+File.separator+"tempForXit";
}
return workPath;
}
}

@ -12,7 +12,6 @@ import java.util.Base64;
import java.util.Base64.Decoder;
import java.util.Base64.Encoder;
import java.util.List;
import java.util.stream.Stream;
import cokr.xit.base.file.FileInfo;
import cokr.xit.fims.cmmn.CmmnUtil;
@ -23,12 +22,14 @@ public class SingleFileParser extends LayoutParser {
private int tempGroupSeq = 1;
@Override
public List<DataObject> parsing(Stream<Path> fileList) {
public List<DataObject> parsing(List<Path> fileList) {
List<DataObject> dataObjectList = new ArrayList<>();
fileList.forEach(item -> {
DataObject dataObject = new DataObject();
dataObject.put("FILE_GROUP_TYPE", "BIN");
File file = item.toFile();
String filePath = file.getPath();
dataObject.put("FILE_PATH", filePath);

@ -366,7 +366,7 @@ public class CrdnBean extends AbstractComponent {
}
//빈 디렉토리 삭제
CmmnUtil.deleteEmptyDir(new File("files"+File.separator+"tempForIno"), false);
CmmnUtil.deleteEmptyDir(new File(workPath), false);
} catch (Exception e) {
throw new RuntimeException(e);
}

@ -225,4 +225,10 @@ public class CrdnStngBean extends AbstractComponent {
return globalStngMapper.selectLinkFileLayoutMetadata(query);
}
public LayoutDescriptor getLinkFileLayoutMetadata(String fileLayoutId) {
CrdnQuery query = new CrdnQuery();
query.setFileLayoutId(fileLayoutId);
List<LayoutDescriptor> list = globalStngMapper.selectLinkFileLayoutMetadata(query);
return list == null ? null : list.get(0);
}
}

@ -80,11 +80,12 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
public HashMap<String, Object> createCrdnByEquipmentLinkFile(Map<String,String> processInfo, List<DataObject> linkFileInfoList) {
HashMap<String, Object> resultMap = new HashMap<>();
boolean saved = false;
String workPath = processInfo.get("workPath");
String institute = processInfo.get("institute");
String taskSeCd = processInfo.get("taskSeCd");
String entType = processInfo.get("entType");
String equipmentType = processInfo.get("equipmentType");
String workPath = processInfo.get("workPath");
String fileGroupType = processInfo.get("fileGroupType");
Crdn crdn = new Crdn();
crdn.setCrdnRegSeCd("07");
@ -93,10 +94,7 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
//
if(entType.equals("ino")) {
crdn.setCrdnInptSeCd("11");
crdn.setVltnCd("01");
if(fileGroupType.equals("JPG")) {
//1. 연계파일정보를 단속 엔티티로 변환
DataObject bgngData = linkFileInfoList.stream()
@ -111,6 +109,14 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
crdn.setCrdnEndTm(endData.string("CRDN_TM"));
DataObject linkFileInfo = endData;
String entType = linkFileInfo.string("ENT_TYPE");
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
else crdn.setCrdnInptSeCd("15");
crdn.setCrdnInptSeCd("11");
crdn.setVltnCd("01");
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
crdn.setVhrno(linkFileInfo.string("VHRNO"));
crdn.setCrdnYmd(linkFileInfo.string("CRDN_YMD"));
@ -135,19 +141,9 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
}
//
if(entType.equals("knl")) {
crdn.setCrdnInptSeCd("12");
crdn.setVltnCd("01");
}
//XIT권장포맷
if(entType.equals("xit")) {
crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01");
if(fileGroupType.equals("TXT")) {
//1. 연계파일정보를 단속 엔티티로 변환
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
@ -159,6 +155,13 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
}
}
String entType = metaFileInfo.string("ENT_TYPE");
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
else crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01");
crdn.setCrdnSeCd(metaFileInfo.string("CRDN_SE_CD"));
crdn.setCrdnYmd(metaFileInfo.string("CRDN_YMD"));
crdn.setCrdnTm(metaFileInfo.string("CRDN_TM"));
@ -194,12 +197,7 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
}
//
if(entType.equals("hitecom")) {
crdn.setCrdnSeCd("07");
crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01");
if(fileGroupType.equals("BIN")) {
//1. 연계파일정보를 단속 엔티티로 변환
if(linkFileInfoList.size() != 1) {
@ -208,6 +206,16 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
return resultMap;
}
DataObject linkFileInfo = linkFileInfoList.get(0);
String entType = linkFileInfo.string("ENT_TYPE");
if(entType.equals("ino")) crdn.setCrdnInptSeCd("11");
if(entType.equals("knl")) crdn.setCrdnInptSeCd("12");
else crdn.setCrdnInptSeCd("15");
crdn.setVltnCd("01");
crdn.setCrdnSeCd("07");
crdn.setSggCd(globalStngMapper.selectSggCdForCurrentUser());
crdn.setVhrno(linkFileInfo.string("VHRNO"));
crdn.setCrdnYmd(linkFileInfo.string("CRDN_YMD"));

@ -9,7 +9,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@ -34,11 +33,11 @@ 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.OnlyImageParser;
import cokr.xit.fims.crdn.parsing.ParsingUtil;
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;
import cokr.xit.fims.crdn.service.bean.CrdnStngBean;
import cokr.xit.foundation.data.DataObject;
/** .<br />
@ -75,6 +74,9 @@ public class Crdn05Controller extends ApplicationController {
@Resource(name="crdnStngService")
private CrdnStngService crdnStngService;
@Resource(name="crdnStngBean")
private CrdnStngBean crdnStngBean;
@Resource(name="crdnInstMapper")
private CrdnInstMapper crdnInstMapper;
@ -135,47 +137,44 @@ public class Crdn05Controller extends ApplicationController {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String entType = hReq.getParameter("entType");
LayoutParser parser = null;
switch(entType){
case "ino": parser = new OnlyImageParser(); break;
//case "knl": 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");
String sggCd = globalStngMapper.selectSggCdForCurrentUser();
ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), institute);
String deptCd = currentUser.getDeptCode();
List<LayoutDescriptor> layoutDescriptors = crdnStngService.getLinkFileLayoutMetadata(sggCd, taskSeCd, institute, deptCd);
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
File workDir = new File(workPath);
workDir.mkdirs();
for(int i=0; i < layoutDescriptors.size(); i++) {
DataObject remoteInfo = globalStngMapper.selectRemoteInfo(layoutDescriptors.get(i).getFileLayoutId());
if(remoteInfo == null) {
continue;
}
RemoteSystemInfo rs = new RemoteSystemInfo();
rs.setIp("211.119.124.9");
rs.setId("xituser");
rs.setPw("xituser!@");
rs.setOsType("linux");
String remoteWorkPath = File.separator + "applications"
+ File.separator + "tempForFTPTest"
+ File.separator + "GCloud"
+ File.separator + entType
+ File.separator;
try {
boolean result = FTPUtil.fileDown(rs, remoteWorkPath, workPath);
if(!result) {
saved = false;
mav.addObject("saved", saved);
return mav;
}
} catch (Exception e) {
e.printStackTrace();
saved = false;
mav.addObject("saved", saved);
return mav;
RemoteSystemInfo rs = new RemoteSystemInfo();
rs.setIp(remoteInfo.string("REMOTE_IP"));
rs.setId(remoteInfo.string("REMOTE_ID"));
rs.setPw(remoteInfo.string("REMOTE_PASSWORD"));
rs.setOsType(remoteInfo.string("REMOTE_OS"));
String remoteWorkPath = remoteInfo.string("REMOTE_WORK_PATH");
String workPath = layoutDescriptors.get(i).getLinkFileLocation();
File workDir = new File(workPath);
workDir.mkdirs();
try {
boolean result = FTPUtil.fileDown(rs, remoteWorkPath, workPath);
if(!result) {
saved = false;
mav.addObject("saved", saved);
return mav;
}
} catch (Exception e) {
e.printStackTrace();
saved = false;
mav.addObject("saved", saved);
return mav;
}
}
saved = true;
@ -191,33 +190,38 @@ public class Crdn05Controller extends ApplicationController {
ModelAndView mav = new ModelAndView("jsonView");
boolean saved = false;
String entType = hReq.getParameter("entType");
LayoutParser parser = null;
switch(entType){
case "ino": parser = new OnlyImageParser(); break;
//case "knl": 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");
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
String sggCd = globalStngMapper.selectSggCdForCurrentUser();
ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), institute);
String deptCd = currentUser.getDeptCode();
List<LayoutDescriptor> layoutDescriptors = crdnStngService.getLinkFileLayoutMetadata(sggCd, taskSeCd, institute, deptCd);
LayoutDescriptor layoutDescriptor = new LayoutDescriptor();
if(layoutDescriptors.size() == 1) {
layoutDescriptor = layoutDescriptors.get(0);
} else if(layoutDescriptors.size() >= 2) {
layoutDescriptor = LayoutDiscriminator.choice(uploadFiles, layoutDescriptors);
}
String workPath = layoutDescriptor.getLinkFileLocation();
File workDir = new File(workPath);
workDir.mkdirs();
try {
for(int i=0; i < uploadFiles.length; i++) {
File newFile = new File(workPath+File.separator+uploadFiles[i].getOriginalFilename());
uploadFiles[i].transferTo(newFile);
for(int j=0; j < uploadFiles.length; j++) {
File newFile = new File(workPath+File.separator+uploadFiles[j].getOriginalFilename());
uploadFiles[j].transferTo(newFile);
}
} catch (Exception e) {
saved = false;
mav.addObject("saved", saved);
return mav;
}
saved = true;
mav.addObject("saved", saved);
return mav;
@ -229,47 +233,43 @@ public class Crdn05Controller extends ApplicationController {
*/
public ModelAndView getEquipmentFileInfoList(HttpServletRequest hReq) {
ModelAndView mav = new ModelAndView("jsonView");
List<DataObject> parsedDataList = new ArrayList<DataObject>();
String entType = hReq.getParameter("entType");
LayoutParser parser = null;
switch(entType){
case "ino": parser = new OnlyImageParser(); break;
//case "knl": 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");
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
Stream<Path> fileList = null;
try {
//폴더는 제외하고 파일만 필터링
fileList = Files.walk(Paths.get(workPath)).filter(Files::isRegularFile);
} catch (IOException e) {
e.printStackTrace();
}
String institute = currentUser().getInstitute();
String sggCd = globalStngMapper.selectSggCdForCurrentUser();
ManagedUser currentUser = userMapper.getUser(currentUser().getAccount(), institute);
String deptCd = currentUser.getDeptCode();
List<LayoutDescriptor> candidates = crdnStngService.getLinkFileLayoutMetadata(sggCd, taskSeCd, institute, deptCd);
List<LayoutDescriptor> layoutDescriptors = crdnStngService.getLinkFileLayoutMetadata(sggCd, taskSeCd, institute, deptCd);
if(candidates == null || candidates.isEmpty()) {
if(layoutDescriptors == null || layoutDescriptors.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, "");
for(int i=0; i < layoutDescriptors.size(); i++) {
String workPath = layoutDescriptors.get(i).getLinkFileLocation();
List<Path> fileList = null;
try {
//폴더는 제외하고 파일만 필터링
fileList = Files.walk(Paths.get(workPath)).filter(Files::isRegularFile).toList();
} catch (IOException e) {
e.printStackTrace();
}
LayoutParser parser = null;
switch(layoutDescriptors.get(i).getFileGroup()){
case "TXT": parser = new AttachedTxtParser(); break;
case "JPG": parser = new OnlyImageParser(); break;
case "BIN": parser = new SingleFileParser(); break;
}
if(!fileList.isEmpty()) {
parsedDataList.addAll(parser.parsing(fileList));
}
}
mav = setCollectionInfo(mav, parsedDataList, "");
return mav;
}
@ -284,13 +284,12 @@ public class Crdn05Controller extends ApplicationController {
ModelAndView mav = new ModelAndView("jsonView");
String entType = hReq.getParameter("entType");
String fileLayoutId = hReq.getParameter("fileLayoutId");
String fileName = hReq.getParameter("fileName");
String institute = currentUser().getInstitute();
String taskSeCd = hReq.getParameter("taskSeCd");
String equipmentType = hReq.getParameter("equipmentType");
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
LayoutDescriptor info = crdnStngBean.getLinkFileLayoutMetadata(fileLayoutId);
String workPath = info.getLinkFileLocation();
boolean saved = crdnService.removeEquipmentLinkFile(workPath, fileName);
@ -300,13 +299,13 @@ public class Crdn05Controller extends ApplicationController {
/** .
* @param entType , linkFileInfos
* @param taskSeCd , fileGroupType , linkFileInfos
* @return jsonView
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String equipmentType, String[] linkFileInfos) {
public ModelAndView createCrdnByLinkFile(String taskSeCd, String fileGroupType, String[] linkFileInfos) {
ModelAndView mav = new ModelAndView("jsonView");
String institute = currentUser().getInstitute();
@ -320,10 +319,10 @@ public class Crdn05Controller extends ApplicationController {
Map<String, String> processInfo = new HashMap<String,String>();
processInfo.put("institute", institute);
processInfo.put("taskSeCd", taskSeCd);
processInfo.put("entType", entType);
processInfo.put("equipmentType", equipmentType);
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
processInfo.put("fileGroupType", fileGroupType);
String workPath = crdnStngBean.getLinkFileLayoutMetadata("fileLayoutId").getLinkFileLocation();
processInfo.put("workPath", workPath);
HashMap<String, Object> resultMap = importService.createCrdnByEquipmentLinkFile(processInfo, linkFileInfoList);

@ -242,8 +242,8 @@ public class BpvController {
@Override
@RequestMapping(name="전용차로과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile)
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String equipmentType, String[] linkFileInfos) {
return super.createCrdnByLinkFile(taskSeCd, entType, equipmentType, linkFileInfos);
public ModelAndView createCrdnByLinkFile(String taskSeCd, String fileGroupType, String[] linkFileInfos) {
return super.createCrdnByLinkFile(taskSeCd, fileGroupType, linkFileInfos);
}
@Override

@ -268,8 +268,8 @@ public class DpvController {
@Override
@RequestMapping(name="장애인과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile)
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String equipmentType, String[] linkFileInfos) {
return super.createCrdnByLinkFile(taskSeCd, entType, equipmentType, linkFileInfos);
public ModelAndView createCrdnByLinkFile(String taskSeCd, String fileGroupType, String[] linkFileInfos) {
return super.createCrdnByLinkFile(taskSeCd, fileGroupType, linkFileInfos);
}
@Override

@ -243,8 +243,8 @@ public class EcaController {
@Override
@RequestMapping(name="전기차과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile)
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String equipmentType, String[] linkFileInfos) {
return super.createCrdnByLinkFile(taskSeCd, entType, equipmentType, linkFileInfos);
public ModelAndView createCrdnByLinkFile(String taskSeCd, String fileGroupType, String[] linkFileInfos) {
return super.createCrdnByLinkFile(taskSeCd, fileGroupType, linkFileInfos);
}
@Override

@ -255,8 +255,8 @@ public class PvsController {
@Override
@RequestMapping(name="주정차과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile)
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String equipmentType, String[] linkFileInfos) {
return super.createCrdnByLinkFile(taskSeCd, entType, equipmentType, linkFileInfos);
public ModelAndView createCrdnByLinkFile(String taskSeCd, String fileGroupType, String[] linkFileInfos) {
return super.createCrdnByLinkFile(taskSeCd, fileGroupType, linkFileInfos);
}
@Override

@ -59,7 +59,7 @@ SELECT CONCAT(A.EMD_NM,
</select>
<select id="selectLinkFileLayoutMetadata" parameterType="map" resultMap="descriptorRow">
/* 연계파일 레이아웃 정보 조회(crdnTeamMapper.selectLinkFileLayoutMetadata) */
/* 연계파일 레이아웃 정보 조회(globalStngMapper.selectLinkFileLayoutMetadata) */
SELECT FILE_LAYOUT_ID
, SGG_CD
, TASK_SE_CD
@ -77,10 +77,30 @@ SELECT FILE_LAYOUT_ID
, LINK_FILE_PATH
FROM TB_CRDN_FILE_LAYOUT
WHERE USE_YN = 'Y'
<choose>
<when test="fileLayoutId != null and fileLayoutId != '' ">
AND FILE_LAYOUT_ID = #{fileLayoutId}
</when>
<otherwise>
AND SGG_CD = #{sggCd}
AND TASK_SE_CD = #{taskSeCd}
AND INST_CD = #{instCd}
AND DEPT_CD = #{deptCd}
</otherwise>
</choose>
</select>
<select id="selectRemoteInfo" parameterType="string" resultType="dataobject">
/* 연계파일 fpt정보 조회(globalStngMapper.selectRemoteInfo) */
SELECT FILE_LAYOUT_ID
, REMOTE_IP
, REMOTE_ID
, REMOTE_PASSWORD
, REMOTE_OS
, REMOTE_WORK_PATH
FROM TB_FTP_INFO
WHERE FILE_LAYOUT_ID = #{fileLayoutId}
</select>
</mapper>

@ -18,40 +18,12 @@
</select>
</div>
<div class="col-md-4">
<c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV'}">
<label for="equipmentType--${pageName}"
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end">장비 구분</label>
<select id="equipmentType--${pageName}" name="equipmentType" class="form-select">
<option value="">선택</option>
<option value="고정형">고정형</option>
<option value="주행형">주행형</option>
<option value="버스장착형">버스장착형</option>
<option value="MOBILE">모바일(스마트폰)</option>
</select>
</c:if>
</div>
<div class="col-md-4 d-flex align-items-center flex-nowrap">
<label for="entType--${pageName}"
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>
</c:if>
<c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV'}">
<option value="gasan">가산정보통신</option>
<option value="elisoft">엘리소프트</option>
<option value="hitecom">하이테콤</option>
</c:if>
<c:if test="${taskSeCd == '미세먼지'}">
<option value="unknown">unknown</option>
</c:if>
</select>
<span class="d-flex justify-content-end float-end ms-auto me-4">
<button type="button" id="btnSearch--${pageName}" class="btn btn-primary">조회</button>
</span>
</div>
<div class="col-md-4 d-flex align-items-center flex-nowrap">
</div>
<div class="col-md-12 d-flex align-items-center flex-nowrap">
<label for="uploadFiles--${pageName}"
@ -189,8 +161,6 @@ pageObject["${pageName}"] = {};
$(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.entType = "";
$P.equipmentType = "";
$P.tempGroup = {};
@ -214,7 +184,7 @@ $(document).ready(function(){
**************************************************************************/
$P.parsedInfoControl.onDatasetChange = (obj) => {
$P.renderParsedInfoList(obj["Total"], $P.entType);
$P.renderParsedInfoList(obj["Total"]);
$("#parsedInfoPaging--${pageName}").setPagingInfo({
list: $P.parsedInfoControl.dataset,
@ -232,11 +202,9 @@ $(document).ready(function(){
if(item && item.data){
var dataKey = item.data.FILE_NAME;
if($P.entType != ""){
$("#table-responsive--${pageName}").find("tbody").setCurrentRow(dataKey);
}
$("#table-responsive--${pageName}").find("tbody").setCurrentRow(dataKey);
if(item.data.ENT_TYPE == "hitecom"){
if(item.data.FILE_GROUP_TYPE == "BIN"){
var srcArr = [
"data:image/jpg;base64,"+item.data.CAR_IMAGE,
"data:image/jpg;base64,"+item.data.PLATE_IMAGE
@ -267,9 +235,7 @@ $(document).ready(function(){
ajax.post({
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/importFileFromServer.do"),
data : {
taskSeCd : $("#taskSeCd--${pageName}").val(),
entType : $("#entType--${pageName}").val(),
equipmentType : $("#equipmentType--${pageName}").val()
taskSeCd : $("#taskSeCd--${pageName}").val()
},
success : (resp) => {
if(resp.saved){
@ -311,19 +277,12 @@ $(document).ready(function(){
//서버에 등록된 파일 조회
$P.searchFileList = () => {
$P.parsedInfoControl.setData([]);
$P.entType = $("#entType--${pageName}").val();
$P.equipmentType = $("#equipmentType--${pageName}").val();
ajax.post({
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/list.do"),
data : {
taskSeCd : $("#taskSeCd--${pageName}").val(),
entType : $("#entType--${pageName}").val(),
equipmentType : $("#equipmentType--${pageName}").val()
taskSeCd : $("#taskSeCd--${pageName}").val()
},
success : (resp) => {
$P.parsedInfoControl.setData(resp);
@ -332,23 +291,23 @@ $(document).ready(function(){
}
//테이블 렌더링
$P.renderParsedInfoList = (total, entType) => {
if(entType != ""){
var parsedInfoList = $P.parsedInfoControl.dataset;
var empty = parsedInfoList.empty;
var notFound = [$("#table-responsive--${pageName}").find("template.notFound")[0].innerHTML];
var found = $("#table-responsive--${pageName}").find("template.found")[0].innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickParsedInfoList('" + dataItem.getValue("FILE_NAME") + "');");
$P.renderParsedInfoList = (total) => {
var trs = empty ? notFound : parsedInfoList.inStrings(found,replacer);
var parsedInfoList = $P.parsedInfoControl.dataset;
var empty = parsedInfoList.empty;
var notFound = [$("#table-responsive--${pageName}").find("template.notFound")[0].innerHTML];
var found = $("#table-responsive--${pageName}").find("template.found")[0].innerHTML;
var replacer = (str, dataItem) => str
.replace(/{onclick}/gi, "pageObject['${pageName}'].clickParsedInfoList('" + dataItem.getValue("FILE_NAME") + "');");
$("#table-responsive--${pageName}").find("tbody").html(trs.join());
var trs = empty ? notFound : parsedInfoList.inStrings(found,replacer);
if(!empty){
fnDownsizeCheck($("#table-responsive--${pageName}").find("table")[0]);
}
$("#table-responsive--${pageName}").find("tbody").html(trs.join());
if(!empty){
fnDownsizeCheck($("#table-responsive--${pageName}").find("table")[0]);
}
}
//사진 표시
@ -400,8 +359,7 @@ $(document).ready(function(){
var firstGroupKey = Object.keys($P.tempGroup)[0];
var formData = new FormData(document.getElementById("frmMultipart--${pageName}"));
formData.append("taskSeCd", "${taskSeCd}");
formData.append("entType", $P.entType);
formData.append("equipmentType", $("#equipmentType--${pageName}").val());
formData.append("fileGroupType", $P.tempGroup[firstGroupKey][0].FILE_GROUP_TYPE);
if($P.tempGroup[firstGroupKey].length == 1){
formData.append("linkFileInfos", JSON.stringify({}));
}
@ -441,13 +399,13 @@ $(document).ready(function(){
if(current == null) return;
var fileName = current.FILE_NAME;
var fileLayoutId = current.FILE_LAYOUT_ID;
ajax.get({
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/remove.do"),
data : {
taskSeCd : $("#taskSeCd--${pageName}").val(),
entType : $P.entType,
equipmentType : $("#equipmentType--${pageName}").val(),
fileLayoutId : fileLayoutId,
fileName : fileName
},
success : (resp) => {
@ -464,23 +422,23 @@ $(document).ready(function(){
}
$P.removeTableRow = (removedFileName) => {
if($P.entType != ""){
var fileListTable = $("#table-responsive--${pageName}").find("table")[0];
var targetArr = [];
if(Array.isArray(removedFileName)){
targetArr = removedFileName;
} else {
targetArr = [removedFileName];
}
var fileListTable = $("#table-responsive--${pageName}").find("table")[0];
for(var i = 0; i < targetArr.length; i++){
var target = targetArr[i];
var tr = $(fileListTable).find("tbody").find("tr[data-key='"+target+"']");
var trIndex = $(fileListTable).find("tbody tr").index(tr);
fileListTable.deleteRow(trIndex+1);
}
var targetArr = [];
if(Array.isArray(removedFileName)){
targetArr = removedFileName;
} else {
targetArr = [removedFileName];
}
for(var i = 0; i < targetArr.length; i++){
var target = targetArr[i];
var tr = $(fileListTable).find("tbody").find("tr[data-key='"+target+"']");
var trIndex = $(fileListTable).find("tbody tr").index(tr);
fileListTable.deleteRow(trIndex+1);
}
}
/**************************************************************************

Loading…
Cancel
Save