단속연계파일 등록 수정

main
이범준 1 year ago
parent 66ef616e6b
commit 57cfe2355a

@ -8,8 +8,16 @@ import cokr.xit.foundation.data.DataObject;
public interface EquipmentEnterprise {
/** .<br />
* @param fileList
* @return
*/
public List<DataObject> parsing(Stream<Path> fileList);
/** .<br />
* @param currentItem , beforeItem
* @return
*/
public boolean isChangeCrackdown(DataObject currentItem, DataObject beforeItem);
}

@ -0,0 +1,26 @@
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";
}
return workPath;
}
}

@ -77,6 +77,6 @@ public interface CrdnService {
* @param entType , fileName
* @return
*/
boolean removeEquipmentLinkFile(String entType, String fileName);
boolean removeEquipmentLinkFile(String workPath, String fileName);
}

@ -2,6 +2,7 @@ package cokr.xit.fims.crdn.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import cokr.xit.foundation.data.DataObject;
@ -19,5 +20,5 @@ public interface ImportService {
* @param dataObject
* @return
*/
HashMap<String, Object> createCrdnByEquipmentLinkFile(String taskSeCd, String entType, List<DataObject> linkFileInfoList);
HashMap<String, Object> createCrdnByEquipmentLinkFile(Map<String,String> processInfo, List<DataObject> linkFileInfoList);
}

@ -344,35 +344,31 @@ public class CrdnBean extends AbstractComponent {
}
/** .
* @param entType , fileName
* @param workPath , fileName
* @return
*/
public boolean removeEquipmentLinkFile(String entType, String fileName) {
public boolean removeEquipmentLinkFile(String workPath, String fileName) {
boolean saved = false;
if(entType.equals("INO")) {
try {
try {
Stream<Path> walk = Files.walk(Paths.get(workPath));
Stream<Path> walk = Files.walk(Paths.get("files"+File.separator+"tempForIno"));
List<String> deleteFilePaths = new ArrayList<String>();
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()));
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();
}
//빈 디렉토리 삭제
CmmnUtil.deleteEmptyDir(new File("files"+File.separator+"tempForIno"), false);
} catch (Exception e) {
throw new RuntimeException();
for(String deleteFilePath : deleteFilePaths) {
saved = (new File(deleteFilePath)).delete();
}
//빈 디렉토리 삭제
CmmnUtil.deleteEmptyDir(new File("files"+File.separator+"tempForIno"), false);
} catch (Exception e) {
throw new RuntimeException();
}
return saved;

@ -242,7 +242,7 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService
}
@Override
public boolean removeEquipmentLinkFile(String entType, String fileName) {
return crdnBean.removeEquipmentLinkFile(entType, fileName);
public boolean removeEquipmentLinkFile(String workPath, String fileName) {
return crdnBean.removeEquipmentLinkFile(workPath, fileName);
}
}

@ -76,9 +76,14 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
}
@Override
public HashMap<String, Object> createCrdnByEquipmentLinkFile(String taskSeCd, String entType, List<DataObject> linkFileInfoList) {
public HashMap<String, Object> createCrdnByEquipmentLinkFile(Map<String,String> processInfo, List<DataObject> linkFileInfoList) {
HashMap<String, Object> resultMap = new HashMap<>();
boolean saved = false;
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");
Crdn crdn = new Crdn();
crdn.setCrdnRegSeCd("07");
@ -149,7 +154,7 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ
if(saved) {
for(DataObject delInfo : linkFileInfoList) {
crdnBean.removeEquipmentLinkFile(entType, delInfo.string("FILE_NAME"));
crdnBean.removeEquipmentLinkFile(workPath, delInfo.string("FILE_NAME"));
}
if(!ifEmpty(crdn.getErsrRegYmd(), () -> "").equals("")) {

@ -1,6 +1,5 @@
package cokr.xit.fims.crdn.web;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@ -29,6 +28,8 @@ import cokr.xit.fims.crdn.parsing.EquipmentEnterprise;
import cokr.xit.fims.crdn.parsing.HiteCom;
import cokr.xit.fims.crdn.parsing.Ino;
import cokr.xit.fims.crdn.parsing.Knl;
import cokr.xit.fims.crdn.parsing.ParsingUtil;
import cokr.xit.fims.crdn.parsing.XitRecommend;
import cokr.xit.fims.crdn.service.CrdnService;
import cokr.xit.fims.crdn.service.CrdnStngService;
import cokr.xit.fims.crdn.service.ImportService;
@ -48,8 +49,8 @@ public class Crdn05Controller extends ApplicationController {
getTodayCrdnDataList = "/010/list.do",
getFileRegistrationScreen = "/020/info.do",
importFileFromServer = "/020/importFileFromServer",
importFileFromClient = "/020/importFileFromClient",
importFileFromServer = "/020/importFileFromServer.do",
importFileFromClient = "/020/importFileFromClient.do",
getEquipmentFileInfoList = "/020/list.do",
removeLinkFile = "/020/remove.do",
createCrdnByLinkFile = "/020/create.do",
@ -131,41 +132,31 @@ public class Crdn05Controller extends ApplicationController {
case "INO": enterprise = new Ino(); break;
case "KNL": enterprise = new Knl(); break;
case "HITECOM": enterprise = new HiteCom(); break;
//case "": enterprise = new (); break;
case "XIT": enterprise = new XitRecommend(); break;
//case "": enterprise = new (); break;
}
String institute = currentUser().getInstitute();
String taskSeCd = hReq.getParameter("taskSeCd");
String equipmentType = hReq.getParameter("equipmentType");
Stream<Path> fileList = null;
List<DataObject> dataObjectList = new ArrayList<>();
String downloadRoot = ""; //ftp나 usb에서 다운받는 파일 경로
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
//ftp G클라우드
if(entType.equals("INO")) {
//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 + "ino"
// + File.separator;
downloadRoot = "files"+File.separator+"tempForIno";
}
if(entType.equals("KNL")) {
downloadRoot = "files"+File.separator+"tempForKnl";
}
if(entType.equals("HITECOM")) {
downloadRoot = "files"+File.separator+"tempForHitecom";
}
//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 + "ino"
// + File.separator;
try {
//boolean result = FTPUtil.fileDown(rs, remoteWorkPath, downloadRoot);
//boolean result = FTPUtil.fileDown(rs, remoteWorkPath, workPath);
} catch (Exception e) {
e.printStackTrace();
}
@ -189,26 +180,14 @@ public class Crdn05Controller extends ApplicationController {
case "INO": enterprise = new Ino(); break;
case "KNL": enterprise = new Knl(); break;
case "HITECOM": enterprise = new HiteCom(); break;
case "XIT": enterprise = new XitRecommend(); break;
//case "": enterprise = new (); break;
//case "": enterprise = new (); break;
}
Stream<Path> fileList = null;
List<DataObject> dataObjectList = new ArrayList<>();
String downloadRoot = ""; //ftp나 usb에서 다운받는 파일 경로
if(entType.equals("INO")) {
downloadRoot = "files"+File.separator+"tempForIno";
}
if(entType.equals("KNL")) {
downloadRoot = "files"+File.separator+"tempForKnl";
}
if(entType.equals("HITECOM")) {
downloadRoot = "files"+File.separator+"tempForHitecom";
}
String institute = currentUser().getInstitute();
String taskSeCd = hReq.getParameter("taskSeCd");
String equipmentType = hReq.getParameter("equipmentType");
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
//TODO :
@ -229,37 +208,25 @@ public class Crdn05Controller extends ApplicationController {
case "INO": enterprise = new Ino(); break;
case "KNL": enterprise = new Knl(); break;
case "HITECOM": enterprise = new HiteCom(); break;
//case "": enterprise = new (); break;
case "XIT": enterprise = new XitRecommend(); break;
//case "": enterprise = new (); break;
}
Stream<Path> fileList = null;
List<DataObject> dataObjectList = new ArrayList<>();
String downloadRoot = "";
if(entType.equals("INO") || entType.equals("KNL")) {
if(entType.equals("INO")) {
downloadRoot = "files"+File.separator+"tempForIno";
}
if(entType.equals("KNL")) {
downloadRoot = "files"+File.separator+"tempForKnl";
}
}
if(entType.equals("HITECOM")) {
downloadRoot = "files"+File.separator+"tempForHitecom";
}
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(downloadRoot)).filter(Files::isRegularFile);
fileList = Files.walk(Paths.get(workPath)).filter(Files::isRegularFile);
} catch (IOException e) {
e.printStackTrace();
}
dataObjectList = enterprise.parsing(fileList);
List<DataObject> dataObjectList = enterprise.parsing(fileList);
mav = setCollectionInfo(mav, dataObjectList, "");
return mav;
}
@ -278,7 +245,12 @@ public class Crdn05Controller extends ApplicationController {
String entType = hReq.getParameter("entType");
String fileName = hReq.getParameter("fileName");
boolean saved = crdnService.removeEquipmentLinkFile(entType, fileName);
String institute = currentUser().getInstitute();
String taskSeCd = hReq.getParameter("taskSeCd");
String equipmentType = hReq.getParameter("equipmentType");
String workPath = ParsingUtil.getWorkDirectoryPath(institute, taskSeCd, entType, equipmentType);
boolean saved = crdnService.removeEquipmentLinkFile(workPath, fileName);
mav.addObject("saved", saved);
return mav;
@ -292,16 +264,25 @@ public class Crdn05Controller extends ApplicationController {
* "saved": true, false
* }</code></pre>
*/
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String[] linkFileInfos) {
public ModelAndView createCrdnByLinkFile(String taskSeCd, String entType, String equipmentType, String[] linkFileInfos) {
ModelAndView mav = new ModelAndView("jsonView");
String institute = currentUser().getInstitute();
List<DataObject> linkFileInfoList = new ArrayList<DataObject>();
for(String linkFileInfo : linkFileInfos) {
linkFileInfoList.add(fromJson(linkFileInfo, DataObject.class));
}
HashMap<String, Object> resultMap = importService.createCrdnByEquipmentLinkFile(taskSeCd, entType, linkFileInfoList);
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("workPath", workPath);
HashMap<String, Object> resultMap = importService.createCrdnByEquipmentLinkFile(processInfo, linkFileInfoList);
boolean saved = (boolean) resultMap.get("saved");
mav.addObject("saved", saved);

@ -240,6 +240,12 @@ public class BpvController {
return super.removeLinkFile(hReq);
}
@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);
}
@Override
@RequestMapping(name="전용차로과태료업무 단속자료 수기 등록 화면", value=METHOD_URL.getManualRegistrationScreen)
public ModelAndView getManualRegistrationScreen(HttpServletRequest hReq) {

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

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

@ -253,6 +253,12 @@ public class PvsController {
return super.removeLinkFile(hReq);
}
@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);
}
@Override
@RequestMapping(name="주정차과태료업무 단속자료 수기 등록 화면", value=METHOD_URL.getManualRegistrationScreen)
public ModelAndView getManualRegistrationScreen(HttpServletRequest hReq) {

@ -30,8 +30,6 @@
<option value="GASAN">가산정보통신</option>
<option value="ELISOFT">엘리소프트</option>
<option value="XIT">XIT권장포맷</option>
</c:if>
<c:if test="${taskSeCd == 'BPV'}">
<option value="HITECOM">하이테콤</option>
</c:if>
<c:if test="${taskSeCd == '미세먼지'}">
@ -41,9 +39,9 @@
</div>
<div class="col-md-4 d-flex align-items-center flex-nowrap">
<c:if test="${taskSeCd == 'PVS' or taskSeCd == 'BPV'}">
<label for="cctvType--${pageName}"
<label for="equipmentType--${pageName}"
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end">장비 구분</label>
<select id="cctvType--${pageName}" name="cctvType" class="form-select">
<select id="equipmentType--${pageName}" name="equipmentType" class="form-select">
<option value="">선택</option>
<option value="고정형">고정형</option>
<option value="주행형">주행형</option>
@ -58,7 +56,7 @@
<div class="col-md-12 d-flex align-items-center flex-nowrap">
<label for="localFile--${pageName}"
class="w-px-120 bg-lighter pe-2 col-form-label text-sm-end">파일</label>
<input type="file" id="localFile--${pageName}" name="localFile" multiple="multiple" />
<input type="file" id="localFile--${pageName}" name="localFile" multiple="multiple" class="form-control"/>
<span class="d-flex justify-content-end float-end ms-auto me-4">
<button type="button" id="btnFileUpload--${pageName}" class="btn btn-primary">업로드</button>
</span>
@ -220,6 +218,7 @@ $(document).ready(function(){
var $P = pageObject["${pageName}"];
$P.entType = "";
$P.equipmentType = "";
$P.tempGroup = {};
@ -313,10 +312,16 @@ $(document).ready(function(){
ajax.post({
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/importFileFromServer.do"),
data : { entType : $("#entType--${pageName}").val() },
data : {
taskSeCd : $("#taskSeCd--${pageName}").val(),
entType : $("#entType--${pageName}").val(),
equipmentType : $("#equipmentType--${pageName}").val()
},
success : (resp) => {
if(resp.saved){
$P.searchFileList();
} else {
dialog.alert("파일 조회에 실패하였습니다.");
}
}
});
@ -336,10 +341,16 @@ $(document).ready(function(){
ajax.post({
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/importFileFromClient.do"),
data : { entType : $("#entType--${pageName}").val() },
data : {
taskSeCd : $("#taskSeCd--${pageName}").val(),
entType : $("#entType--${pageName}").val(),
equipmentType : $("#equipmentType--${pageName}").val()
},
success : (resp) => {
if(resp.saved){
$P.searchFileList();
} else {
dialog.alert("파일 업로드에 실패하였습니다.");
}
}
});
@ -360,12 +371,18 @@ $(document).ready(function(){
$P.entType = "";
}
$P.equipmentType = $("#equipmentType--${pageName}").val();
$("#table-responsive--${pageName}").find("span").attr("hidden","hidden");
$("#table-responsive--${pageName}").find("."+$P.entType).removeAttr("hidden");
ajax.post({
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/list.do"),
data : { entType : $("#entType--${pageName}").val() },
data : {
taskSeCd : $("#taskSeCd--${pageName}").val(),
entType : $("#entType--${pageName}").val(),
equipmentType : $("#equipmentType--${pageName}").val()
},
success : (resp) => {
$P.parsedInfoControl.setData(resp);
}
@ -442,6 +459,7 @@ $(document).ready(function(){
var formData = new FormData(document.getElementById("frmMultipart--${pageName}"));
formData.append("taskSeCd", "${taskSeCd}");
formData.append("entType", $P.entType);
formData.append("equipmentType", $("#equipmentType--${pageName}").val());
for(var i=0; i<$P.tempGroup[firstGroupKey].length; i++){
formData.append("linkFileInfos", JSON.stringify($P.tempGroup[firstGroupKey][i]));
}
@ -482,7 +500,9 @@ $(document).ready(function(){
ajax.get({
url : wctx.url("/${taskSeCd}/crdn/crdn05/020/remove.do"),
data : {
taskSeCd : $("#taskSeCd--${pageName}").val(),
entType : $P.entType,
equipmentType : $("#equipmentType--${pageName}").val(),
fileName : fileName
},
success : (resp) => {

@ -9,10 +9,6 @@ label.required:after {
color: red;
}
input[type=file] {
height: 24px;
padding: 0 5px; }
input[type=text]:disabled, input[type=text]:read-only {
background-color: #eceef1;
}

Loading…
Cancel
Save