From 6c7d4e9fe3cf228f65ad8d0dfed74986b47291eb Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 21 Sep 2023 13:52:00 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8B=A8=EC=86=8D=EC=97=B0=EA=B3=84=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=82=AD=EC=A0=9C=20=EA=B8=B0=EB=8A=A5=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/crdn/parsing/Ino.java | 19 +----- .../xit/fims/crdn/parsing/XitRecommend.java | 32 ++++++++++ .../xit/fims/crdn/web/Crdn05Controller.java | 60 ++++++++++++++++--- .../cokr/xit/fims/task/web/DpvController.java | 6 ++ .../cokr/xit/fims/task/web/EcaController.java | 6 ++ .../WEB-INF/jsp/fims/crdn/crdn05020-info.jsp | 48 +++++++++++++-- 6 files changed, 141 insertions(+), 30 deletions(-) diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java b/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java index a2c8fd80..fd0e0215 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/Ino.java @@ -102,11 +102,11 @@ public class Ino implements EquipmentEnterprise { @Override public boolean isChangeCrackdown(DataObject currentItem, DataObject beforeItem) { - if(!currentItem.string("DEVICE_ID").equals(beforeItem.string("DEVICE_ID"))) { + if(!currentItem.string("VHRNO").equals(beforeItem.string("VHRNO"))) { return true; } - if(!currentItem.string("VHRNO").equals(beforeItem.string("VHRNO"))) { + if(!currentItem.string("PHOTO_CNT").equals(beforeItem.string("PHOTO_CNT"))) { return true; } @@ -114,21 +114,6 @@ public class Ino implements EquipmentEnterprise { return true; } - SimpleDateFormat ymdTm = new SimpleDateFormat("yyyyMMddHHmmss"); - - try { - Date cDate = ymdTm.parse(currentItem.string("CRDN_YMD_TM")); - Date bDate = ymdTm.parse(beforeItem.string("CRDN_YMD_TM")); - - long diff = Math.abs(cDate.getTime() - bDate.getTime()); - - if(diff >= (1000 * 60 * 60 * 24)) { - return true; - } - } catch (Exception e) { - throw new RuntimeException(); - } - return false; } } diff --git a/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java b/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java index abbd1226..695ece43 100644 --- a/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java +++ b/src/main/java/cokr/xit/fims/crdn/parsing/XitRecommend.java @@ -1,12 +1,20 @@ package cokr.xit.fims.crdn.parsing; +import java.io.BufferedReader; import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.InputStreamReader; +import java.nio.charset.Charset; import java.nio.file.Path; 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; + import cokr.xit.foundation.data.DataObject; public class XitRecommend implements EquipmentEnterprise{ @@ -31,6 +39,30 @@ public class XitRecommend implements EquipmentEnterprise{ //TODO: + String[] fileNameSplit = fileName.split(Matcher.quoteReplacement("_")); + + + //dataObject.put("", ); + //dataObject.put("", ); + //dataObject.put("", ); + //dataObject.put("", ); + //dataObject.put("", ); + + boolean isMetaData = FilenameUtils.getExtension(fileName).toUpperCase().equals("TXT"); + if(isMetaData) { + + BufferedReader br = null; + try { + br = new BufferedReader(new InputStreamReader(new FileInputStream(file),Charset.forName("EUC-KR"))); + } catch (FileNotFoundException e) { + + } + + //파일내용.split(Matcher.quoteReplacement(",")); + + } else { + + } dataObjectList.add(dataObject); }); diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java index f0319199..808078ae 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java @@ -9,6 +9,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Resource; @@ -47,6 +48,7 @@ public class Crdn05Controller extends ApplicationController { getFileRegistrationScreen = "/020/info.do", getCrdnFileListFromEquipmentEnterprise = "/020/list.do", + removeLinkFile = "/020/remove.do", getManualRegistrationScreen = "/030/info.do", createCrdnDataByManual = "/030/create.do" @@ -79,6 +81,18 @@ public class Crdn05Controller extends ApplicationController { return mav; } + /**당일 등록한 단속자료 목록을 조회한다. + * {@link CrdnService#getCrackdownList(CrdnQuery)} 참고 + * @param query 단속자료 목록 조회 조건 + * @return jsonView + */ + public ModelAndView getTodayCrdnDataList(CrdnQuery query) { + setFetchSize(query); + query.setGridType("todayInsert"); + query.setCurrentUserId(currentUser().getId()); + return setCollectionInfo(new ModelAndView("jsonView"),crdnService.getCrackdownList(query),""); + } + /**단속자료 파일 등록 팝업화면을 반환한다. * @param * @return fims/crdn/crdn05020-info @@ -166,16 +180,46 @@ public class Crdn05Controller extends ApplicationController { return mav; } - /**당일 등록한 단속자료 목록을 조회한다. - * {@link CrdnService#getCrackdownList(CrdnQuery)} 참고 - * @param query 단속자료 목록 조회 조건 + /**단속 연계 파일을 삭제한다. + * @param hReq 삭제 요청 * @return jsonView + *
 {
+	 *     "saved": 등록되었으면 true, 그렇지 않으면 false
+	 * }
*/ - public ModelAndView getTodayCrdnDataList(CrdnQuery query) { - setFetchSize(query); - query.setGridType("todayInsert"); - query.setCurrentUserId(currentUser().getId()); - return setCollectionInfo(new ModelAndView("jsonView"),crdnService.getCrackdownList(query),""); + public ModelAndView removeLinkFile(HttpServletRequest hReq) { + ModelAndView mav = new ModelAndView("jsonView"); + boolean saved = false; + + String entType = hReq.getParameter("entType"); + String fileName = hReq.getParameter("fileName"); + + + + if(entType.equals("이노")) { + + try { + Stream walk = Files.walk(Paths.get("files"+File.separator+"tempForIno")); + + List deleteFilePaths = new ArrayList(); + + walk.filter(Files::isRegularFile) + .filter(p -> p.getFileName().toString().equalsIgnoreCase(fileName)) + .collect(Collectors.toList()) + .forEach(item -> deleteFilePaths.add(item.toFile().getPath())); + + for(String deleteFilePath : deleteFilePaths) { + saved = (new File(deleteFilePath)).delete(); + } + + } catch (Exception e) { + throw new RuntimeException(); + } + + } + + mav.addObject("saved", saved); + return mav; } /**단속자료 수기 등록 팝업화면을 반환한다. diff --git a/src/main/java/cokr/xit/fims/task/web/DpvController.java b/src/main/java/cokr/xit/fims/task/web/DpvController.java index 84831e6b..ee3959b4 100644 --- a/src/main/java/cokr/xit/fims/task/web/DpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/DpvController.java @@ -245,6 +245,12 @@ public class DpvController { return super.getCrdnFileListFromEquipmentEnterprise(hReq); } + @Override + @RequestMapping(name="장애인과태료업무 장비업체 단속파일 삭제", value=METHOD_URL.removeLinkFile) + public ModelAndView removeLinkFile(HttpServletRequest hReq) { + return super.removeLinkFile(hReq); + } + @Override @RequestMapping(name="장애인과태료업무 단속자료 수기 등록 화면", value=METHOD_URL.getManualRegistrationScreen) public ModelAndView getManualRegistrationScreen(HttpServletRequest hReq) { diff --git a/src/main/java/cokr/xit/fims/task/web/EcaController.java b/src/main/java/cokr/xit/fims/task/web/EcaController.java index 627e474a..0ad927f1 100644 --- a/src/main/java/cokr/xit/fims/task/web/EcaController.java +++ b/src/main/java/cokr/xit/fims/task/web/EcaController.java @@ -222,6 +222,12 @@ public class EcaController { return super.getCrdnFileListFromEquipmentEnterprise(hReq); } + @Override + @RequestMapping(name="전기차과태료업무 장비업체 단속파일 삭제", value=METHOD_URL.removeLinkFile) + public ModelAndView removeLinkFile(HttpServletRequest hReq) { + return super.removeLinkFile(hReq); + } + @Override @RequestMapping(name="전기차과태료업무 단속자료 수기 등록 화면", value=METHOD_URL.getManualRegistrationScreen) public ModelAndView getManualRegistrationScreen(HttpServletRequest hReq) { diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05020-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05020-info.jsp index 998dbbec..9403082f 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05020-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn05020-info.jsp @@ -145,8 +145,8 @@
- - + +
@@ -188,6 +188,16 @@ $(document).ready(function(){ }); }; + $P.crdnControl.onCurrentChange = (item) => { + if(item && item.data){ + var dataKey = item.data.FILE_NAME; + $("#crdnTbody--${pageName}").setCurrentRow(dataKey); + + var url = item.data.FILE_PATH; + $("#img--${pageName}").attr("src",url); + } + }; + /************************************************************************** * pageObject.function **************************************************************************/ @@ -212,10 +222,8 @@ $(document).ready(function(){ if(dataKey == ""){ return; } - $("#crdnTbody--${pageName}").setCurrentRow(dataKey); - var url = $P.crdnControl.dataset.getData(dataKey).FILE_PATH; - $("#img--${pageName}").attr("src",url); + $P.crdnControl.setCurrent(dataKey); }; @@ -272,6 +280,36 @@ $(document).ready(function(){ return; }); + $("#btnInsertCrdn--${pageName}").on("click", function(){ + + }); + + $("#btnDelete--${pageName}").on("click", function(){ + var current = $P.crdnControl.getCurrent(); + if(current == null) return; + + var fileName = current.FILE_NAME; + + ajax.get({ + url : wctx.url("/${taskSeCd}/crdn/crdn05/020/remove.do"), + data : { + entType : $("#entType--${pageName}").val(), + fileName : fileName + }, + success : (resp) => { + if(resp.saved){ + $P.crdnControl.dataset.remove(fileName); + + var fileListTable = document.getElementById("DataTables_Table_0--${pageName}"); + var tr = $(fileListTable).find("tbody").find("tr[data-key='"+fileName+"']"); + var trIndex = $(fileListTable).find("tbody tr").index(tr); + fileListTable.deleteRow(trIndex+1); + } + } + }); + }); + + $P.crdnControl.setData([]); }); \ No newline at end of file