연계용xml파일 내용 조회 기능 추가

main
이범준 1 year ago
parent 6529f0fc14
commit d2534cc1f3

@ -1,6 +1,10 @@
package cokr.xit.fims.base;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
@ -141,4 +145,33 @@ public class UserController extends cokr.xit.base.user.web.UserController<Manage
mav.addObject("saved", saved);
return mav;
}
@RequestMapping(name="최고관리자 서버 파일 내용 보기", value="/superUser/getFileText.do")
public ModelAndView getFileText(@RequestParam(value="directories[]") String... directories) throws Exception {
String fileCn = "";
StringBuilder sb = new StringBuilder();
String path = String.join(File.separator, directories);
int inputData = 0;
try {
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(path),Charset.forName("EUC-KR")));
while ((inputData = br.read()) != -1) {
sb.append((char)inputData) ;
}
fileCn = sb.toString();
br.close();
} catch (Exception e) {
}
ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView");
mav.addObject("fileCn", fileCn);
return mav;
}
}

@ -7,6 +7,7 @@
<title>Insert title here</title>
</head>
<body>
주정차과태료, 전용차로과태료 기능 준비중...
<!-- 단속조명,단속구분,단속원1,단속원2,단속원3,단속원4,특이사항, 등록일,해체일 -->
<!-- 조회,등록,수정,삭제,비사용단속조 조회 -->
</body>

@ -7,6 +7,7 @@
<title>Insert title here</title>
</head>
<body>
전용차로과태료 기능 준비중...
<!-- 차량번호,사유,공문번호,소유주명,단속동,면제시작일,면제종료일, 입력자,입력일시,수정자,수정일시,삭제자,삭제사유,삭제일시 -->
<!-- 조회,등록,수정,삭제,이력 조회 -->
</body>

@ -42,9 +42,9 @@
</div>
<div style="width:49%;">
<h5 class="mt-3">기타</h5>
<div class="d-flex flex-row justify-content-end p-3">
<h5 class="mt-3">파일내용</h5>
<div class="d-flex flex-row justify-content-start p-3">
<textarea id="viewCn" rows="14" cols="100%" readonly="readonly"></textarea>
</div>
</div>
</div>
@ -154,6 +154,25 @@ function customContextMenu(node){
$("#serverFile").click();
}
},
viewCn : {
label : "내용 보기",
action:function(data){
var inst = $.jstree.reference(data.reference);
var obj = inst.get_node(data.reference);
var pathArray = $("#fileTree").jstree("get_path", obj.id);
ajax.post({
url : wctx.url("/user/superUser/getFileText.do"),
data : {
directories : pathArray
},
success : resp => {
$("#viewCn").val(resp.fileCn);
}
});
}
}
};
@ -163,6 +182,13 @@ function customContextMenu(node){
delete items.newFile;
}
if(node.type == "directory"){
delete items.viewCn;
} else if(!node.text.endsWith(".txt") && !node.text.endsWith(".xml")
&& !node.text.endsWith(".TXT") && !node.text.endsWith(".XML")){
delete items.viewCn;
}
return items;
}

Loading…
Cancel
Save