주소구축 기능 추가

main
이범준 5 months ago
parent 9be4006690
commit 6cab1efd7a

@ -29,6 +29,7 @@
</repositories>
<dependencies>
<!-- 1. 앱 지원 -->
<dependency>
<groupId>cokr.xit.app</groupId>
@ -127,6 +128,8 @@
<version>2.0.1</version>
</dependency>
</dependencies>
<build>

@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Configuration
@ComponentScan(basePackages = {"cokr.xit",
"externalsystem.juso",
"externalsystem.sinmungo",
"externalsystem.nxrp",
"externalsystem.piss",

@ -100,8 +100,8 @@ public class MvcConfig implements WebMvcConfigurer {
public CommonsMultipartResolver multipartResolver() {
CommonsMultipartResolver bean = new CommonsMultipartResolver();
int oneGB = 1_073_741_824; // 1GB=1,073,741,824 byte
bean.setMaxUploadSize(oneGB);
bean.setMaxInMemorySize(oneGB);
bean.setMaxUploadSize(oneGB * 10);
bean.setMaxInMemorySize(oneGB * 10);
return bean;
}

@ -0,0 +1,17 @@
package externalsystem.juso;
import cokr.xit.foundation.AbstractEntity;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class EstablishJusoRequest extends AbstractEntity {
private String driver;
private String dbConn;
private String dbUserId;
private String dbPassword;
private String tableSpace;
private String tableName;
}

@ -0,0 +1,70 @@
package externalsystem.juso;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStreamReader;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.regex.Pattern;
public class EstablishJusoThread implements Runnable {
private EstablishJusoRequest vo;
public EstablishJusoThread(EstablishJusoRequest vo) {
this.vo = vo;
}
@Override
public void run() {
String workDirPath = "files/juso";
File workDir = new File(workDirPath);
String[] txtNames = workDir.list();
BufferedReader reader = null;
StringBuffer strSQL = new StringBuffer();
strSQL.append("INSERT INTO "+vo.getTableSpace()+"."+vo.getTableName()
+" VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
Connection conn = null;
try {
conn = getConn(vo.getDriver(), vo.getDbConn(),vo.getDbUserId(),vo.getDbPassword());
for(int i=0; i < txtNames.length; i++) {
PreparedStatement ps = conn.prepareStatement(strSQL.toString());
reader = new BufferedReader(new InputStreamReader(new FileInputStream(workDir+"/"+txtNames[i]),"MS949"));
for(String line = reader.readLine(); line != null; line = reader.readLine()) {
if(!line.equals("")) {
String[] params = line.split(Pattern.quote("|"), -1);
for(int j=0; j<params.length;j++) {
ps.setString(j, params[j]);
}
ps.executeUpdate();
conn.commit();
}
}
reader.close();
ps.close();
}
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
private Connection getConn(String driver, String connInfo, String id, String pw) throws Exception{
Class.forName(driver);
return DriverManager.getConnection(connInfo, id, pw);
}
}

@ -0,0 +1,76 @@
package externalsystem.juso.web;
import java.io.File;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.io.FileUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;
import cokr.xit.foundation.web.AbstractController;
import externalsystem.juso.EstablishJusoRequest;
import externalsystem.juso.EstablishJusoThread;
import externalsystem.juso.service.JusoService;
@Controller
@RequestMapping(name="주소", value="/juso")
public class JusoController extends AbstractController {
@Resource(name="jusoService")
private JusoService jusoService;
@RequestMapping(name="주소구축팝업", value="/establishJusoMain.do")
public ModelAndView establishJusoMain(HttpServletRequest req) {
ModelAndView mav = new ModelAndView("juso/establishJuso-main");
mav.addObject("pageName", "establishJusoMain");
return mav;
}
@RequestMapping(name="주소파일업로드", value="/fileUpload.do")
public ModelAndView fileUpload(HttpServletRequest req, MultipartFile[] txts) {
String workDirPath = "files/juso";
File workDir = new File(workDirPath);
try {
if(workDir.exists()) {
FileUtils.cleanDirectory(workDir);
} else {
workDir.mkdirs();
}
for(MultipartFile txt : txts) {
String fileName = txt.getOriginalFilename();
String newFileFullPath = workDirPath + "/" + fileName;
File newFile = new File(newFileFullPath);
txt.transferTo(newFile);
}
} catch (Exception e) {
e.printStackTrace();
}
ModelAndView mav = new ModelAndView("jsonView");
mav.addObject("result", "ok");
return mav;
}
@RequestMapping(name="주소구축", value="/establishJuso.do")
public ModelAndView establishJuso(HttpServletRequest req, EstablishJusoRequest jusoReq) {
EstablishJusoThread runnable = new EstablishJusoThread(jusoReq);
Thread thread = new Thread(runnable);
thread.setName("establishJusoThread");
thread.start();
ModelAndView mav = new ModelAndView("jsonView");
mav.addObject("result", "ok");
return mav;
}
}

@ -1,5 +1,6 @@
package externalsystem.testpool;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Arrays;

@ -7,7 +7,7 @@ spring:
application:
name: external-system-test
main:
allow-bean-definition-overriding: true
allow-bean-definition-overriding: true
sql:
init:
platform: mariadb

@ -26,6 +26,11 @@
<button type="button" id="btnSendMobileMessagePop" class="btn btn-primary">모바일 메시지 API 테스트 창</button>
</div>
<div class="container-xxl container-p-y ms-1">
<h5>주소</h5>
<button type="button" id="btnPopEstablishJuso" class="btn btn-primary">주소구축</button>
</div>
</div>
</div>
@ -37,150 +42,180 @@
<jsp:include page="/WEB-INF/jsp/include/tail.jsp" />
<script>
$("#btnMakePersonNamePool").on("click",function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/testpool/makeName.do",
data: {},
success: (resp) => {
}
});
});
$("#btnMakeCarNoPool").on("click",function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/testpool/makeCarNoPool.do",
data: {},
success: (resp) => {
}
});
});
$("#btnSendMobileMessagePop").on("click",function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/mms/sendMobileMessagePop.do",
data: {},
success: (resp) => {
dialog.open({
id: "mmsSendTest",
title: "mms발송테스트",
content: resp ,
size: "lg",
init:() => {}
});
}
});
});
$("#btnForSinmungoAdmin").on("click", function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/sinmungo/openSinmungoAdmin.do",
data: {},
success: (resp) => {
console.log(resp);
dialog.open({
id: "sinmungoAdminDialog",
title: "접수및배분",
content: resp ,
size: "fullscreen",
init:() => {}
});
},
error : function(xhr, status, error) {
},
complete : function(xhr, status) {
}
});
});
$("#btnMessageAccountValidation").on("click", function(){
fetch(wctx.url("/resources/html/smsAccountValidation.html"))
.then(function(resp) { return resp.text(); })
.then(function(template) {
let dialogName = "smsAccountValidationDialog";
let dialogId = dialogName + "-" + uuid();
dialog.open({
id: dialogId
, title: "sms 계정 신청 검증"
, size: "lg"
, content: template
, init: () => {
$("#"+dialogId).attr("name", dialogName);
}
});
});
});
$("#btnMakeConfForMessage").on("click", function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/mms/createConfMain.do",
data: {},
success: (resp) => {
console.log(resp);
dialog.open({
id: "makeMessageConfDialog",
title: "nuri모듈 설정파일 작성",
content: resp ,
size: "md",
init:() => {}
});
},
error : function(xhr, status, error) {
},
complete : function(xhr, status) {
}
});
});
$("#btnMakeScriptForMessage").on("click", function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/mms/createScriptMain.do",
data: {},
success: (resp) => {
console.log(resp);
dialog.open({
id: "makeMessageScriptDialog",
title: "nuri모듈 실행파일 작성",
content: resp ,
size: "md",
init:() => {}
});
},
error : function(xhr, status, error) {
},
complete : function(xhr, status) {
}
});
});
$(function(){
});
</script>
<script>
$("#btnMakePersonNamePool").on("click",function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/testpool/makeName.do",
data: {},
success: (resp) => {
}
});
});
$("#btnMakeCarNoPool").on("click",function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/testpool/makeCarNoPool.do",
data: {},
success: (resp) => {
}
});
});
$("#btnSendMobileMessagePop").on("click",function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/mms/sendMobileMessagePop.do",
data: {},
success: (resp) => {
dialog.open({
id: "mmsSendTest",
title: "mms발송테스트",
content: resp ,
size: "lg",
init:() => {}
});
}
});
});
$("#btnForSinmungoAdmin").on("click", function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/sinmungo/openSinmungoAdmin.do",
data: {},
success: (resp) => {
console.log(resp);
dialog.open({
id: "sinmungoAdminDialog",
title: "접수및배분",
content: resp ,
size: "fullscreen",
init:() => {}
});
},
error : function(xhr, status, error) {
},
complete : function(xhr, status) {
}
});
});
$("#btnMessageAccountValidation").on("click", function(){
fetch(wctx.url("/resources/html/smsAccountValidation.html"))
.then(function(resp) { return resp.text(); })
.then(function(template) {
let dialogName = "smsAccountValidationDialog";
let dialogId = dialogName + "-" + uuid();
dialog.open({
id: dialogId
, title: "sms 계정 신청 검증"
, size: "lg"
, content: template
, init: () => {
$("#"+dialogId).attr("name", dialogName);
}
});
});
});
$("#btnMakeConfForMessage").on("click", function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/mms/createConfMain.do",
data: {},
success: (resp) => {
console.log(resp);
dialog.open({
id: "makeMessageConfDialog",
title: "nuri모듈 설정파일 작성",
content: resp ,
size: "md",
init:() => {}
});
},
error : function(xhr, status, error) {
},
complete : function(xhr, status) {
}
});
});
$("#btnMakeScriptForMessage").on("click", function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/mms/createScriptMain.do",
data: {},
success: (resp) => {
console.log(resp);
dialog.open({
id: "makeMessageScriptDialog",
title: "nuri모듈 실행파일 작성",
content: resp ,
size: "md",
init:() => {}
});
},
error : function(xhr, status, error) {
},
complete : function(xhr, status) {
}
});
});
$("#btnPopEstablishJuso").on("click", function(){
$.ajax({
type : "GET",
ContentType : "text/html;charset=UTF-8",
url : "/juso/establishJusoMain.do",
data: {},
success: (resp) => {
console.log(resp);
dialog.open({
id: "establishJusoMainDialog",
title: "주소구축",
content: resp ,
size: "md",
init:() => {}
});
},
error : function(xhr, status, error) {
},
complete : function(xhr, status) {
}
});
});
$(function(){
});
</script>
</body>
</html>

@ -0,0 +1,77 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<div style="border: 1px solid black;margin-bottom: 30px;">
<form id="frmFileInfo--${pageName}" method="post" enctype="multipart/form-data">
<strong>주소파일</strong><br/>
<input type="file" name="txts" multiple /><br/>
<button type="button" id="btnFileUpload--${pageName}">주소파일업로드</button>
</form>
</div>
<div style="border: 1px solid black;">
<form id="frmDatabaseInfo--${pageName}">
db드라이버<input type="text" name="driver"
list="driverList--${pageName}" class="w-px-350"/>
<br/>
db접속정보<input type="text" name="dbConn" placeholder="드라이버:@아이피:포트:서비스명"
list="dbConnList--${pageName}" class="w-px-350"/>
<br/>
db유저아이디<input type="text" name="dbUserId" />
<br/>
db패스워드<input type="text" name="dbPassword" />
<br/>
테이블스페이스<input type="text" name="tableSpace" />
<br/>
테이블명<input type="text" name="tableName" />
<br/>
</form>
<button type="button" id="btnEstablishJuso--${pageName}">주소구축</button>
</div>
<datalist id="driverList--${pageName}">
<option>com.tmax.tibero.jdbc.TbDriver</option>
</datalist>
<datalist id="dbConnList--${pageName}">
<option>jdbc:tibero:thin:@211.119.124.22:8629:tibero</option>
</datalist>
<script>
$("#btnFileUpload--${pageName}").on("click",function(){
var formData = new FormData(document.getElementById("frmFileInfo--${pageName}"));
ajax.post({
url: wctx.url("juso/fileUpload.do"),
data: formData,
contentType : false, processData : false,
success: (resp) => {
dialog.alert({
content : "업로드되었습니다.",
init : function(){},
onClose : () => {}
});
}
});
});
$("#btnEstablishJuso--${pageName}").on("click",function(){
var formData = new FormData(document.getElementById("frmDatabaseInfo--${pageName}"));
ajax.post({
url: wctx.url("juso/establishJuso.do"),
data: formData,
contentType : false, processData : false,
success: (resp) => {
dialog.alert({
content : "주소구축 요청완료.",
init : function(){},
onClose : () => {}
});
}
});
});
</script>

@ -25,7 +25,7 @@
<br/>
db아이피<input type="text" name="dbIp" />
<br/>
db포트<input type="text" name="dbPassword" />
db포트<input type="text" name="dbPort" />
<br/>
db유저아이디<input type="text" name="dbUserId" />
<br/>

Loading…
Cancel
Save