From abe02c26ce34a1f1832e6ff0a67a146235609f8a Mon Sep 17 00:00:00 2001 From: rosewiper Date: Wed, 4 Oct 2023 09:52:55 +0900 Subject: [PATCH] =?UTF-8?q?=EC=9D=B4=ED=8C=8C=ED=94=BC=EB=A3=A8=EC=8A=A4?= =?UTF-8?q?=20OCR=20=EC=8B=A0=EA=B7=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 --- .../textsense/service/TextSenseService.java | 19 ++ .../kccadr/textsense/service/TextSenseVO.java | 199 +++++++++++ .../textsense/service/impl/TextSenseDAO.java | 77 +++++ .../service/impl/TextSenseServiceImpl.java | 88 +++++ .../textsense/web/TextSenseAPIComm.java | 102 ++++++ .../textsense/web/TextSenseController.java | 312 ++++++++++++++++++ .../egovProps/globals_local.properties | 2 + .../sql-map-config-mysql-kccadr-textsense.xml | 7 + .../kccadr/textsense/TextSense_SQL_Mysql.xml | 114 +++++++ .../kccadr/textSense/EgovTextSenseDetail.jsp | 235 +++++++++++++ .../kccadr/textSense/EgovTextSenseList.jsp | 176 ++++++++++ .../kccadr/textSense/EgovTextSenseRegist.jsp | 285 ++++++++++++++++ 12 files changed, 1616 insertions(+) create mode 100644 src/main/java/kcc/kccadr/textsense/service/TextSenseService.java create mode 100644 src/main/java/kcc/kccadr/textsense/service/TextSenseVO.java create mode 100644 src/main/java/kcc/kccadr/textsense/service/impl/TextSenseDAO.java create mode 100644 src/main/java/kcc/kccadr/textsense/service/impl/TextSenseServiceImpl.java create mode 100644 src/main/java/kcc/kccadr/textsense/web/TextSenseAPIComm.java create mode 100644 src/main/java/kcc/kccadr/textsense/web/TextSenseController.java create mode 100644 src/main/resources/egovframework/sqlmap/config/mysql/sql-map-config-mysql-kccadr-textsense.xml create mode 100644 src/main/resources/egovframework/sqlmap/kccadr/textsense/TextSense_SQL_Mysql.xml create mode 100644 src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseDetail.jsp create mode 100644 src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseList.jsp create mode 100644 src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseRegist.jsp diff --git a/src/main/java/kcc/kccadr/textsense/service/TextSenseService.java b/src/main/java/kcc/kccadr/textsense/service/TextSenseService.java new file mode 100644 index 00000000..5c1206fe --- /dev/null +++ b/src/main/java/kcc/kccadr/textsense/service/TextSenseService.java @@ -0,0 +1,19 @@ +package kcc.kccadr.textsense.service; + +import java.util.List; + +public interface TextSenseService { + + //TextSense OCR 처리요청 결과 내용 저장 + public int insertTextSenseRequestResultInfo(TextSenseVO textSenseVO) throws Exception; + + //TextSense OCR 처리요청 리스트 + public List selectTextSenseList(TextSenseVO textSenseVO) throws Exception; + + //TextSense OCR 처리요청 리스트 갯수 + public int selectTextSenseListCount(TextSenseVO textSenseVO) throws Exception; + + //TextSense OCR 상세내용 불러오기 + public TextSenseVO selectTextSenseDetail(TextSenseVO textSenseVO) throws Exception; + +} \ No newline at end of file diff --git a/src/main/java/kcc/kccadr/textsense/service/TextSenseVO.java b/src/main/java/kcc/kccadr/textsense/service/TextSenseVO.java new file mode 100644 index 00000000..d1c2f2e2 --- /dev/null +++ b/src/main/java/kcc/kccadr/textsense/service/TextSenseVO.java @@ -0,0 +1,199 @@ +package kcc.kccadr.textsense.service; + +import java.io.Serializable; + +import kcc.com.cmm.ComDefaultVO; + +public class TextSenseVO extends ComDefaultVO implements Serializable{ + + private String apiUrl; + private String inputUri; + private String outputUri; + private String taskName; + private String callbackUri; + + //extraJob 파라미터 부분 + private String url; + private String reqType; + private String reqOption; + private String outputType; + private String type; + private String pages; + + //결과 파라미터 부분 + private String id; + private String status; + private String inputFileLenth; + private String outputFileLenth; + private String createdat; + private String queuedat; + private String startdat; + private String completedat; + private String updatedat; + private String maxRetryCount; + private String retryCount; + private String collectedby; + private String externalId; + + private String frstRegisterId; + private String frstRegistPnttm; + + + public String getApiUrl() { + return apiUrl; + } + public void setApiUrl(String apiUrl) { + this.apiUrl = apiUrl; + } + public String getInputUri() { + return inputUri; + } + public void setInputUri(String inputUri) { + this.inputUri = inputUri; + } + public String getOutputUri() { + return outputUri; + } + public void setOutputUri(String outputUri) { + this.outputUri = outputUri; + } + public String getTaskName() { + return taskName; + } + public void setTaskName(String taskName) { + this.taskName = taskName; + } + public String getCallbackUri() { + return callbackUri; + } + public void setCallbackUri(String callbackUri) { + this.callbackUri = callbackUri; + } + public String getUrl() { + return url; + } + public void setUrl(String url) { + this.url = url; + } + public String getReqType() { + return reqType; + } + public void setReqType(String reqType) { + this.reqType = reqType; + } + public String getReqOption() { + return reqOption; + } + public void setReqOption(String reqOption) { + this.reqOption = reqOption; + } + public String getOutputType() { + return outputType; + } + public void setOutputType(String outputType) { + this.outputType = outputType; + } + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + public String getPages() { + return pages; + } + public void setPages(String pages) { + this.pages = pages; + } + public String getId() { + return id; + } + public void setId(String id) { + this.id = id; + } + public String getStatus() { + return status; + } + public void setStatus(String status) { + this.status = status; + } + public String getInputFileLenth() { + return inputFileLenth; + } + public void setInputFileLenth(String inputFileLenth) { + this.inputFileLenth = inputFileLenth; + } + public String getOutputFileLenth() { + return outputFileLenth; + } + public void setOutputFileLenth(String outputFileLenth) { + this.outputFileLenth = outputFileLenth; + } + public String getCreatedat() { + return createdat; + } + public void setCreatedat(String createdat) { + this.createdat = createdat; + } + public String getQueuedat() { + return queuedat; + } + public void setQueuedat(String queuedat) { + this.queuedat = queuedat; + } + public String getStartdat() { + return startdat; + } + public void setStartdat(String startdat) { + this.startdat = startdat; + } + public String getCompletedat() { + return completedat; + } + public void setCompletedat(String completedat) { + this.completedat = completedat; + } + public String getUpdatedat() { + return updatedat; + } + public void setUpdatedat(String updatedat) { + this.updatedat = updatedat; + } + public String getMaxRetryCount() { + return maxRetryCount; + } + public void setMaxRetryCount(String maxRetryCount) { + this.maxRetryCount = maxRetryCount; + } + public String getRetryCount() { + return retryCount; + } + public void setRetryCount(String retryCount) { + this.retryCount = retryCount; + } + public String getCollectedby() { + return collectedby; + } + public void setCollectedby(String collectedby) { + this.collectedby = collectedby; + } + public String getExternalId() { + return externalId; + } + public void setExternalId(String externalId) { + this.externalId = externalId; + } + public String getFrstRegisterId() { + return frstRegisterId; + } + public void setFrstRegisterId(String frstRegisterId) { + this.frstRegisterId = frstRegisterId; + } + public String getFrstRegistPnttm() { + return frstRegistPnttm; + } + public void setFrstRegistPnttm(String frstRegistPnttm) { + this.frstRegistPnttm = frstRegistPnttm; + } + +} diff --git a/src/main/java/kcc/kccadr/textsense/service/impl/TextSenseDAO.java b/src/main/java/kcc/kccadr/textsense/service/impl/TextSenseDAO.java new file mode 100644 index 00000000..eba7dcd6 --- /dev/null +++ b/src/main/java/kcc/kccadr/textsense/service/impl/TextSenseDAO.java @@ -0,0 +1,77 @@ +package kcc.kccadr.textsense.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.stereotype.Repository; + +import egovframework.rte.psl.dataaccess.EgovAbstractDAO; +import kcc.kccadr.textsense.service.TextSenseVO; + +@Repository("TextSenseDAO") +public class TextSenseDAO extends EgovAbstractDAO{ + + + public int insertTextSenseRequestResultInfo(TextSenseVO textSenseVO) throws Exception{ + int result = 0; + + try { + + result = update("textSenseDAO.insertTextSenseRequestResultInfo", textSenseVO); + + } catch (Exception e) { + System.out.println("insertTextSenseRequestResultInfo DAO Error !!! " + e); + } + + return result; + } + + //TextSense OCR 처리요청 리스트 + @SuppressWarnings("unchecked") + public List selectTextSenseList(TextSenseVO textSenseVO) throws Exception{ + List resultList = new ArrayList(); + + try { + + resultList = (List) list("textSenseDAO.selectTextSenseList", textSenseVO); + + } catch (Exception e) { + System.out.println("selectTextSenseList Service DAO Error !!! " + e); + } + + return resultList; + } + + //TextSense OCR 처리요청 리스트 갯수 + public int selectTextSenseListCount(TextSenseVO textSenseVO) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = (int) select("textSenseDAO.selectTextSenseListCount", textSenseVO); + + } catch (Exception e) { + System.out.println("selectTextSenseListCount Service DAO Error !!! " + e); + } + + + return resultCnt; + + } + + public TextSenseVO selectTextSenseDetail(TextSenseVO textSenseVO) throws Exception{ + TextSenseVO result = new TextSenseVO(); + + try { + + result = (TextSenseVO) select("textSenseDAO.selectTextSenseDetail", textSenseVO); + + } catch (Exception e) { + System.out.println("selectTextSenseDetail Service DAO Error !!! " + e); + } + + return result; + } + +} diff --git a/src/main/java/kcc/kccadr/textsense/service/impl/TextSenseServiceImpl.java b/src/main/java/kcc/kccadr/textsense/service/impl/TextSenseServiceImpl.java new file mode 100644 index 00000000..937a6833 --- /dev/null +++ b/src/main/java/kcc/kccadr/textsense/service/impl/TextSenseServiceImpl.java @@ -0,0 +1,88 @@ +package kcc.kccadr.textsense.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; + +import org.springframework.stereotype.Service; + +import kcc.kccadr.textsense.service.TextSenseService; +import kcc.kccadr.textsense.service.TextSenseVO; + +@Service("TextSenseService") +public class TextSenseServiceImpl implements TextSenseService{ + + @Resource(name = "TextSenseDAO") + private TextSenseDAO textSenseDAO; + + //TextSense OCR 처리요청 결과 내용 저장 + @Override + public int insertTextSenseRequestResultInfo(TextSenseVO textSenseVO) throws Exception{ + int result = 0; + + try { + + result = textSenseDAO.insertTextSenseRequestResultInfo(textSenseVO); + + } catch (Exception e) { + System.out.println("insertTextSenseRequestResultInfo Service Impl Error !!! " + e); + } + + return result; + } + + //TextSense OCR 처리요청 리스트 + @Override + public List selectTextSenseList(TextSenseVO textSenseVO) throws Exception{ + List resultList = new ArrayList(); + + try { + + resultList = textSenseDAO.selectTextSenseList(textSenseVO); + + } catch (Exception e) { + System.out.println("selectTextSenseList Service Impl Error !!! " + e); + } + + return resultList; + } + + //TextSense OCR 처리요청 리스트 갯수 + @Override + public int selectTextSenseListCount(TextSenseVO textSenseVO) throws Exception{ + + int resultCnt = 0; + + try { + + resultCnt = textSenseDAO.selectTextSenseListCount(textSenseVO); + + } catch (Exception e) { + System.out.println("selectTextSenseListCount Service Impl Error !!! " + e); + } + + + return resultCnt; + + } + + + //TextSense OCR 상세내용 불러오기 + @Override + public TextSenseVO selectTextSenseDetail(TextSenseVO textSenseVO) throws Exception{ + TextSenseVO result = new TextSenseVO(); + + try { + + result = textSenseDAO.selectTextSenseDetail(textSenseVO); + + } catch (Exception e) { + System.out.println("selectTextSenseDetail Service Impl Error !!! " + e); + } + + return result; + } + + +} diff --git a/src/main/java/kcc/kccadr/textsense/web/TextSenseAPIComm.java b/src/main/java/kcc/kccadr/textsense/web/TextSenseAPIComm.java new file mode 100644 index 00000000..aa23b0f8 --- /dev/null +++ b/src/main/java/kcc/kccadr/textsense/web/TextSenseAPIComm.java @@ -0,0 +1,102 @@ +package kcc.kccadr.textsense.web; + +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.springframework.stereotype.Component; + +import kcc.kccadr.textsense.service.TextSenseVO; + +@Component +public class TextSenseAPIComm { + + /* + * TextSense OCR 요청처리 하기 + * + * */ + @SuppressWarnings("unchecked") + public static JSONObject getTextSenseRequest(TextSenseVO textSenseVO) throws Exception{ + JSONObject returnJson = new JSONObject(); + + try { + + String apiUrl = textSenseVO.getApiUrl(); //"http://222.231.43.29:7777/textsense/api/job/build"; + String inputUri = textSenseVO.getInputUri(); //"http://119.193.215.98:8097/kccadrPb/usr/image/common/top_logo.png"; + String outputUri = textSenseVO.getOutputUri(); //"ftp://woo:dkagh@119.193.215.98/usr/ePapyrus/testocr.json"; + //String outputUri = "http://119.193.215.98:8097/web/main/textsence/testOutputUriPage.do"; + String taskName = textSenseVO.getTaskName();//"textsense-test1"; + String callbackUri = textSenseVO.getCallbackUri();//"http://119.193.215.98:8097/web/main/textsence/testCallbackUriPage.do"; + //String extraJobs = ""; + + + JSONObject jsonObject = new JSONObject(); + jsonObject.put("inputUri", inputUri); + jsonObject.put("outputUri", outputUri); + jsonObject.put("taskName", taskName); + jsonObject.put("callbackUri", callbackUri); + + JSONArray extraJobs = new JSONArray(); + JSONObject jsonJobs = new JSONObject(); + + JSONObject jsonOption = new JSONObject(); + + + //extraJobs의 Option 항목 셋팅 해주기 + jsonOption.put("url", textSenseVO.getUrl()); + jsonOption.put("reqType", textSenseVO.getReqType()); + jsonOption.put("reqOption", ""); + jsonOption.put("outputType", textSenseVO.getOutputType()); + + //extraJobs 셋팅해주기 + jsonJobs.put("type", textSenseVO.getType()); + jsonJobs.put("option", jsonOption); + + extraJobs.add(jsonJobs); + + jsonObject.put("extraJobs", extraJobs); + + System.out.println("+++++++++++++++++ json ::: "+jsonObject.toJSONString()); + + HttpClient httpClient = HttpClientBuilder.create().build(); + HttpPost httpPost = new HttpPost(apiUrl); + httpPost.setEntity(new StringEntity(jsonObject.toString(), "UTF-8")); + httpPost.addHeader("Content-type", "application/json"); + httpPost.addHeader("Accept", "application/json"); + + HttpResponse response = httpClient.execute(httpPost); + + String result = ""; + String statusCode = Integer.toString(response.getStatusLine().getStatusCode()); + + if(statusCode.equals("200")) { + result = EntityUtils.toString(response.getEntity()); + + result = new String(result.getBytes("iso-8859-1"));//한글 깨짐 현상이 있어서 변환 해줌. + JSONParser parser = new JSONParser(); + Object obj = parser.parse(result); + JSONObject object = (JSONObject) obj; + + System.out.println("result ::: "+result); + + returnJson = object; + returnJson.put("resultSts", "success"); + }else { + + returnJson.put("resultSts", "fail"); + + } + + } catch (Exception e) { + System.out.println("++++++++++++++++ getTextSenseRequest Error!!! "+e); + returnJson.put("resultSts", "fail"); + } + + return returnJson; + } +} diff --git a/src/main/java/kcc/kccadr/textsense/web/TextSenseController.java b/src/main/java/kcc/kccadr/textsense/web/TextSenseController.java new file mode 100644 index 00000000..7ee94009 --- /dev/null +++ b/src/main/java/kcc/kccadr/textsense/web/TextSenseController.java @@ -0,0 +1,312 @@ +package kcc.kccadr.textsense.web; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springframework.web.servlet.ModelAndView; + +import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; +import egovframework.rte.ptl.mvc.tags.ui.pagination.PaginationInfo; +import kcc.com.cmm.LoginVO; +import kcc.com.cmm.service.EgovFileMngService; +import kcc.com.cmm.service.EgovFileMngUtil; +import kcc.com.cmm.service.FileVO; +import kcc.kccadr.textsense.service.TextSenseService; +import kcc.kccadr.textsense.service.TextSenseVO; +import kcc.let.utl.fcc.service.EgovStringUtil; + +@Controller +public class TextSenseController { + + @Resource(name = "EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + @Resource(name = "EgovFileMngService") + private EgovFileMngService fileMngService; + + @Resource(name = "TextSenseService") + private TextSenseService textSenseService; + + @Value("#{globalSettings['Globals.textSense.apiUrl']}") + private String textSenseApiUrl; + + + @RequestMapping(value="/kccadr/textsence/selectTextSenseList.do") + public String selectTextSenseList(@ModelAttribute("searchVO")TextSenseVO textSenseVO, ModelMap model) throws Exception{ + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + if(user == null) { + + return "redirect:/uat/uia/EgovLoginUsr.do"; + + } + + if(textSenseVO.getPageUnit() != 10) { + textSenseVO.setPageUnit(textSenseVO.getPageUnit()); + } + + if("".equals(textSenseVO.getSearchSortCnd())){ + textSenseVO.setSearchSortCnd("frstRegistPnttm"); + textSenseVO.setSearchSortOrd("desc"); + } + + /** paging */ + PaginationInfo paginationInfo = new PaginationInfo(); + paginationInfo.setCurrentPageNo(textSenseVO.getPageIndex()); + paginationInfo.setRecordCountPerPage(textSenseVO.getPageUnit()); + paginationInfo.setPageSize(textSenseVO.getPageSize()); + + textSenseVO.setFirstIndex(paginationInfo.getFirstRecordIndex()); + textSenseVO.setLastIndex(paginationInfo.getLastRecordIndex()); + textSenseVO.setRecordCountPerPage(paginationInfo.getRecordCountPerPage()); + textSenseVO.setFrstRegisterId(user.getId()); + + paginationInfo.setTotalRecordCount(textSenseService.selectTextSenseListCount(textSenseVO)); + model.addAttribute("paginationInfo", paginationInfo); + List list = textSenseService.selectTextSenseList(textSenseVO); + model.addAttribute("list", list); + + return "kccadr/textSense/EgovTextSenseList"; + } + + /* + * TextSense OCR 등록화면 호출 + * + * */ + @RequestMapping(value="/kccadr/textsence/selectTextSenseRegist.do") + public String selectTextSenseRegist(@ModelAttribute("searchVO")TextSenseVO textSenseVO) throws Exception{ + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + if(user == null) { + + return "redirect:/uat/uia/EgovLoginUsr.do"; + + } + + return "kccadr/textSense/EgovTextSenseRegist"; + } + + + /* + * TextSense OCR 상세화면 호출 + * + * */ + @RequestMapping(value="/kccadr/textsence/selectTextSenseDetail.do") + public String selectTextSenseDetail(@ModelAttribute("searchVO")TextSenseVO textSenseVO, ModelMap model) throws Exception{ + + System.out.println("++++++++++++++++++++"+textSenseVO.getId()); + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + if(user == null) { + + return "redirect:/uat/uia/EgovLoginUsr.do"; + + } + + textSenseVO.setFrstRegisterId(user.getId()); + TextSenseVO resultVO = textSenseService.selectTextSenseDetail(textSenseVO); + + model.addAttribute("textSenseVO", resultVO); + + return "kccadr/textSense/EgovTextSenseDetail"; + } + + + /* + * TextSense OCR API 요청처리해주기 + * + * + * + * */ + @SuppressWarnings("unchecked") + @RequestMapping(value="/kccadr/textsence/textSenseRequestAjax.do") + public ModelAndView textSenseRequest(final MultipartHttpServletRequest multiRequest, TextSenseVO textSenseVO) throws Exception{ + + ModelAndView modelAndView = new ModelAndView(); + modelAndView.setViewName("jsonView"); + + LoginVO user = (LoginVO) EgovUserDetailsHelper.getAuthenticatedUser(); + + if(user == null) { + + modelAndView.addObject("status", "loginFail"); + return modelAndView; + + } + + //첨부파일 등록 API 전송 요청 + final Map files = multiRequest.getFileMap(); + String atchFileId = ""; + String isThumbFile = ""; + + List extList = new ArrayList(); + extList.add("jpg"); + extList.add("jpeg"); + extList.add("png"); + extList.add("tif"); + extList.add("tiff"); + extList.add("multi-tiff"); + extList.add("pdf"); + extList.add("bmp"); + + //알림톡 템플릿에 이미지가 포함되어 있는 경우 처리 + if (!files.isEmpty()){ + + if ("".equals(atchFileId)) { + List result = fileUtil.parseFileInf(files, "TSOCR_", 0, atchFileId, "", isThumbFile); + + for(FileVO fileVO : result) { + + String fileExt = fileVO.getFileExtsn(); + + //파일 확장자 체크 + if(!extList.contains(fileExt)) { + + modelAndView.addObject("result", "fail"); + return modelAndView; + + } + + } + + //파일 정보 디비에 저장 + atchFileId = fileMngService.insertFileInfs(result); + + System.out.println("++++++++++++++ atchFileId ::: "+atchFileId); + } + + } + + //TextSense API 요청 처리 + TextSenseVO apiTextSenseVO = new TextSenseVO(); + String outputFileNm = "ePapy_" + EgovStringUtil.getTimeStamp() + "_OCR.json"; + String apiUrl = textSenseApiUrl + "/textsense/api/job/build"; + String taskName = textSenseVO.getTaskName(); + + apiTextSenseVO.setApiUrl(apiUrl); + apiTextSenseVO.setInputUri("http://119.193.215.98:8097/cmm/fms/FileDown.do?atchFileId="+ atchFileId +"&fileSn=0"); //http://119.193.215.98:8097/kccadrPb/usr/image/common/top_logo.png + apiTextSenseVO.setOutputUri("file:/home/kcc_adr_ocr_dir/" + outputFileNm); + apiTextSenseVO.setCallbackUri("http://119.193.215.98:8097/kccadr/textsence/testCallbackUriPage.do"); + apiTextSenseVO.setTaskName(taskName); + + //extraJobs의 Option 항목 셋팅 해주기 + apiTextSenseVO.setUrl(textSenseApiUrl); + apiTextSenseVO.setReqType("document"); //고정값으로 변경 불가 + apiTextSenseVO.setReqOption(""); //기본값으로 빈값을 넣어준다. + apiTextSenseVO.setOutputType("json"); //지원하는 output type은 pdf, json, excel, text, text-split 입니다 + apiTextSenseVO.setType("textSense"); //고정값으로 변경 불가 + + JSONObject resultJson = TextSenseAPIComm.getTextSenseRequest(apiTextSenseVO); + + System.out.println("==========Controller============== resultJson ::: "+resultJson.toJSONString()); + + //처리 결과가 성공이면 디비에 저장해주고 끝낸다. + String resultSts = resultJson.get("resultSts").toString(); + if(resultSts.equals("success")) { + + //요청 결과내용 데이터베이스에 저장 + TextSenseVO resultJsVO = new TextSenseVO(); + + String id = resultJson.get("id").toString(); + String status = resultJson.get("status").toString(); + + taskName = resultJson.get("name").toString(); + + resultJsVO.setId(id); + resultJsVO.setTaskName(taskName); + resultJsVO.setStatus(status); + resultJsVO.setInputUri(apiTextSenseVO.getInputUri()); + resultJsVO.setOutputUri(apiTextSenseVO.getOutputUri()); + resultJsVO.setCallbackUri(apiTextSenseVO.getCallbackUri()); + resultJsVO.setFrstRegisterId(user.getId()); + + int resultCnt = textSenseService.insertTextSenseRequestResultInfo(resultJsVO); + + System.out.println("+++++++++++++++++ resultCnt ::: "+resultCnt); + + modelAndView.addObject("result", "success"); + modelAndView.addObject("id", id); + modelAndView.addObject("name", taskName); + modelAndView.addObject("status", status); + + }else { + + modelAndView.addObject("result", "fail"); + + } + + return modelAndView; + + } + + @RequestMapping(value="/kccadr/textsence/testCallbackUriPage.do") + public void testCallbackUriPage(HttpServletRequest req, HttpServletResponse res, @RequestBody JSONObject jsonObject) throws Exception{ + + + System.out.println("++++++++++++++++++++++++++/web/main/textsence/testCallbackUriPage.do++++++++++++++++++++++++++++++++++"); + + System.out.println("+++++++++++ jsonString ::: "+jsonObject.toJSONString()); + + JSONParser parser = new JSONParser(); + Object obj = parser.parse(jsonObject.toString()); + JSONObject object = (JSONObject) obj; + + String id = object.get("id").toString(); + String name = object.get("name").toString(); + String inputUri = object.get("inputUri").toString(); + String inputFileLength = object.get("inputFileLength").toString(); + String outputUri = object.get("outputUri").toString(); + String outputFileLength = object.get("outputFileLength").toString(); + String status = object.get("status").toString(); + String createdAt = object.get("createdAt").toString(); + //String queuedAt = object.get("queuedAt").toString(); + String startedAt = object.get("startedAt").toString(); + String completedAt = object.get("completedAt").toString(); + //String updatedAt = object.get("updatedAt").toString(); + String maxRetryCount = object.get("maxRetryCount").toString(); + String retryCount = object.get("retryCount").toString(); + String collectedBy = object.get("collectedBy").toString(); + String callbackUri = object.get("callbackUri").toString(); + + + System.out.println("+++++++++++++++++++++++ id ::: "+id); + System.out.println("+++++++++++++++++++++++ name ::: "+name); + System.out.println("+++++++++++++++++++++++ inputUri ::: "+inputUri); + System.out.println("+++++++++++++++++++++++ inputFileLength ::: "+inputFileLength); + System.out.println("+++++++++++++++++++++++ outputUri ::: "+outputUri); + System.out.println("+++++++++++++++++++++++ outputFileLength ::: "+outputFileLength); + System.out.println("+++++++++++++++++++++++ status ::: "+status); + System.out.println("+++++++++++++++++++++++ createdAt ::: "+createdAt); + //System.out.println("+++++++++++++++++++++++ queuedAt ::: "+queuedAt); + System.out.println("+++++++++++++++++++++++ startedAt ::: "+startedAt); + System.out.println("+++++++++++++++++++++++ completedAt ::: "+completedAt); + //System.out.println("+++++++++++++++++++++++ updatedAt ::: "+updatedAt); + System.out.println("+++++++++++++++++++++++ maxRetryCount ::: "+maxRetryCount); + System.out.println("+++++++++++++++++++++++ retryCount ::: "+retryCount); + System.out.println("+++++++++++++++++++++++ collectedBy ::: "+collectedBy); + System.out.println("+++++++++++++++++++++++ callbackUri ::: "+callbackUri); + + + + + } + +} diff --git a/src/main/resources/egovframework/egovProps/globals_local.properties b/src/main/resources/egovframework/egovProps/globals_local.properties index 2acb261f..158d1ddb 100644 --- a/src/main/resources/egovframework/egovProps/globals_local.properties +++ b/src/main/resources/egovframework/egovProps/globals_local.properties @@ -232,3 +232,5 @@ Globals.Streamdocs.Url=http://192.168.0.176:8085/streamdocs/v4/documents Globals.BizPpurio.siteUrl=https://dev-api.bizppurio.com #\uc2e4\uc11c\ubc84 #Globals.BizPpurio.siteUrl=https://api.bizppurio.com + +Globals.textSense.apiUrl=http://222.231.43.29:7777 diff --git a/src/main/resources/egovframework/sqlmap/config/mysql/sql-map-config-mysql-kccadr-textsense.xml b/src/main/resources/egovframework/sqlmap/config/mysql/sql-map-config-mysql-kccadr-textsense.xml new file mode 100644 index 00000000..c872a538 --- /dev/null +++ b/src/main/resources/egovframework/sqlmap/config/mysql/sql-map-config-mysql-kccadr-textsense.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/src/main/resources/egovframework/sqlmap/kccadr/textsense/TextSense_SQL_Mysql.xml b/src/main/resources/egovframework/sqlmap/kccadr/textsense/TextSense_SQL_Mysql.xml new file mode 100644 index 00000000..7a5c86df --- /dev/null +++ b/src/main/resources/egovframework/sqlmap/kccadr/textsense/TextSense_SQL_Mysql.xml @@ -0,0 +1,114 @@ + + + + + + + + + INSERT + INTO ADR_TEXTSENSE_OCR + ( + ID, + TASK_NAME, + INPUT_URI, + OUTPUT_URI, + STATUS, + CALLBACK_URI, + FRST_REGISTER_ID, + FRST_REGIST_PNTTM + ) + VALUES + ( + #id# + , #taskName# + , #inputUri# + , #outputUri# + , #status# + , #callbackUri# + , #frstRegisterId# + , NOW() + + ) + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseDetail.jsp b/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseDetail.jsp new file mode 100644 index 00000000..47d790c2 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseDetail.jsp @@ -0,0 +1,235 @@ +<%-- + Class Name : EgovTextSenseDetail.jsp + Description : TextSense OCR 상세화면 + Modification Information + + 수정일 수정자 수정내용 + ------- -------- --------------------------- + 2023.09.27 우영두 최초 생성 + + author : 공통서비스 개발팀 JJY + since : 2023.09.27 +--%> +<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> +<%@ taglib prefix="double-submit" uri="http://www.egovframe.go.kr/tags/double-submit/jsp" %> +<%@ taglib prefix="kc" uri="/WEB-INF/tlds/kcc_tld.tld"%> + + + + +OCR 상세화면 + + + + + + + + +
+ + + +
+
+ + +
+

관리자수정

+
    +
  • +
  • +

    OCR 관리

    +
  • +
  • OCR 상세
  • +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OCR ID + +
Task Name + +
Input URI + +
Output URI + +
Callback URI + +
Input 파일 길이 + + + + + + - + + +
Output 파일 길이 + + + + + + - + + +
진행상태 + + + 변환중 + + + 처리완료 + + + 처리실패 + + +
요청 작업 생성 시간 + + + + + + - + + +
대기상태로 변경된 시간 + + + + + + - + + +
변환작업 시작 시간 + + + + + + - + + +
변환작업 완료 시간 + + + + + + - + + +
변환작업 재시도 횟수 + + + + + + - + + +
등록일자 + +
+
+ +
+ +
+
+
+
+ + +
+ + \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseList.jsp b/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseList.jsp new file mode 100644 index 00000000..eb915d44 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseList.jsp @@ -0,0 +1,176 @@ + +<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> +<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %> +<%@ taglib prefix="kc" uri="/WEB-INF/tlds/kcc_tld.tld"%> +<% + /** + * @Class Name : EgovTextSenseList.jsp + * @Description : OCR 관리 리스트 + * @Modification Information + * @ + * @ 수정일 수정자 수정내용 + * @ ------- -------- --------------------------- + * @ 2023.09.26 우영두 최초 생성 + * @author 우영두 + * @since 2023.09.26 + * @version 1.0 + * @see + * + */ +%> + + + + + +OCR 목록 + + +
+ + " /> + " /> + +
+
+ +
+

OCR 목록

+
    +
  • + + + +
  • +
  • +

    OCR 관리

    +
  • +
  • 목록
  • +
+
+ +
+ +
+
+ +
+
+ + + +
+ + + + + + + + + + + + + + + + + + ');" style="cursor:pointer;"> + + + + + + + + + + +
번호TaskName처리상태등록일자
+ + + + + + + + + + 변환중 + + + 처리완료 + + + 처리실패 + + +
+
+ +
+ +
+ +
+ +
+ +
+
+
+ +
+ + diff --git a/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseRegist.jsp b/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseRegist.jsp new file mode 100644 index 00000000..d9345ed2 --- /dev/null +++ b/src/main/webapp/WEB-INF/jsp/kccadr/textSense/EgovTextSenseRegist.jsp @@ -0,0 +1,285 @@ +<%-- + Class Name : EgovTextSenseRegist.jsp + Description : TextSense 파일 등록화면 + Modification Information + + 수정일 수정자 수정내용 + ------- -------- --------------------------- + 2009.03.24 이삼섭 최초 생성 + 2011.08.31 JJY 경량환경 버전 생성 + + author : 공통서비스 개발팀 이삼섭 + since : 2009.03.24 +--%> +<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> +<%@ taglib prefix="ui" uri="http://egovframework.gov/ctl/ui"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> +<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> +<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> +<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator"%> +<%@ taglib prefix="ckeditor" uri="http://ckeditor.com"%> + + + + + + + + +<c:out value='${bdMstr.bbsNm}' /> - 글 등록 + + + + +
+ + + +
+
+ + +
+

OCR 등록

+
    +
  • +
  • +

    OCR관리

    +
  • +
  • 등록
  • +
+
+ + +
+ +
+ + + + + + + + + + + + + + + + +
+ 제목 + + + +
+

첨부파일

+
+ + + +
+ + + + + + + + + + + + + + + + + + + + +
첨부파일 리스트 : 파일명, 종류, 크기, 삭제
파일 명종류크기삭제
+

첨부하실 파일을 마우스로 끌어서 넣어주세요.

+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
첨부파일 리스트 : 파일명, 종류, 크기, 삭제
파일 명종류크기삭제
+ + + + "> + + "> + + +
+
+
+
+ + + +
+
+
+
+ + + + + + + + + +
+
+ +
+
+
+ +
+ + + +