단속연계파일 삭제 기능 추가

main
이범준 1 year ago
parent 909a44755d
commit 6c7d4e9fe3

@ -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;
}
}

@ -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);
});

@ -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
* <pre><code> {
* "saved": true, false
* }</code></pre>
*/
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<Path> walk = Files.walk(Paths.get("files"+File.separator+"tempForIno"));
List<String> deleteFilePaths = new ArrayList<String>();
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;
}
/** .

@ -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) {

@ -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) {

@ -145,8 +145,8 @@
<div class="card my-4 px-2" style="width:100px;height:600px;min-width:100px;">
<div class="d-flex my-2" style="flex-flow:column">
<button type="button" class="btn btn-primary my-2">부과등록</button>
<button type="button" class="btn btn-primary my-2">삭제</button>
<button type="button" id="btnInsertCrdn--${pageName}" class="btn btn-primary my-2">부과등록</button>
<button type="button" id="btnDelete--${pageName}" class="btn btn-primary my-2">삭제</button>
</div>
</div>
</div>
@ -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([]);
});
</script>
Loading…
Cancel
Save