TextSense OCR 요청 및 처리 결과 기능 개발
- 변환 요청 및 결과파일 서버로 저장되도록 처리완료 - callback은 포트 문제인지 오지 않음 - callback이 오면 디비 정보 업데이트 처리하도록 로직 생성 완료 - 처리 상태 확인 버튼 및 기능 추가완료
This commit is contained in:
parent
8785f3c6e2
commit
1422303e5a
@ -16,4 +16,7 @@ public interface TextSenseService {
|
|||||||
//TextSense OCR 상세내용 불러오기
|
//TextSense OCR 상세내용 불러오기
|
||||||
public TextSenseVO selectTextSenseDetail(TextSenseVO textSenseVO) throws Exception;
|
public TextSenseVO selectTextSenseDetail(TextSenseVO textSenseVO) throws Exception;
|
||||||
|
|
||||||
|
//TextSense Callback 데이터 내용 업데이트 해주기
|
||||||
|
public void updateTextSenseCallbackData(TextSenseVO textSenseVO) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -23,11 +23,11 @@ public class TextSenseVO extends ComDefaultVO implements Serializable{
|
|||||||
//결과 파라미터 부분
|
//결과 파라미터 부분
|
||||||
private String id;
|
private String id;
|
||||||
private String status;
|
private String status;
|
||||||
private String inputFileLenth;
|
private String inputFileLength;
|
||||||
private String outputFileLenth;
|
private String outputFileLength;
|
||||||
private String createdat;
|
private String createdat;
|
||||||
private String queuedat;
|
private String queuedat;
|
||||||
private String startdat;
|
private String startedat;
|
||||||
private String completedat;
|
private String completedat;
|
||||||
private String updatedat;
|
private String updatedat;
|
||||||
private String maxRetryCount;
|
private String maxRetryCount;
|
||||||
@ -117,17 +117,18 @@ public class TextSenseVO extends ComDefaultVO implements Serializable{
|
|||||||
public void setStatus(String status) {
|
public void setStatus(String status) {
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
public String getInputFileLenth() {
|
|
||||||
return inputFileLenth;
|
public String getInputFileLength() {
|
||||||
|
return inputFileLength;
|
||||||
}
|
}
|
||||||
public void setInputFileLenth(String inputFileLenth) {
|
public void setInputFileLength(String inputFileLength) {
|
||||||
this.inputFileLenth = inputFileLenth;
|
this.inputFileLength = inputFileLength;
|
||||||
}
|
}
|
||||||
public String getOutputFileLenth() {
|
public String getOutputFileLength() {
|
||||||
return outputFileLenth;
|
return outputFileLength;
|
||||||
}
|
}
|
||||||
public void setOutputFileLenth(String outputFileLenth) {
|
public void setOutputFileLength(String outputFileLength) {
|
||||||
this.outputFileLenth = outputFileLenth;
|
this.outputFileLength = outputFileLength;
|
||||||
}
|
}
|
||||||
public String getCreatedat() {
|
public String getCreatedat() {
|
||||||
return createdat;
|
return createdat;
|
||||||
@ -141,11 +142,12 @@ public class TextSenseVO extends ComDefaultVO implements Serializable{
|
|||||||
public void setQueuedat(String queuedat) {
|
public void setQueuedat(String queuedat) {
|
||||||
this.queuedat = queuedat;
|
this.queuedat = queuedat;
|
||||||
}
|
}
|
||||||
public String getStartdat() {
|
|
||||||
return startdat;
|
public String getStartedat() {
|
||||||
|
return startedat;
|
||||||
}
|
}
|
||||||
public void setStartdat(String startdat) {
|
public void setStartedat(String startedat) {
|
||||||
this.startdat = startdat;
|
this.startedat = startedat;
|
||||||
}
|
}
|
||||||
public String getCompletedat() {
|
public String getCompletedat() {
|
||||||
return completedat;
|
return completedat;
|
||||||
|
|||||||
@ -74,4 +74,17 @@ public class TextSenseDAO extends EgovAbstractDAO{
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TextSense Callback 데이터 내용 업데이트 해주기
|
||||||
|
public void updateTextSenseCallbackData(TextSenseVO textSenseVO) throws Exception{
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
update("textSenseDAO.updateTextSenseCallbackData", textSenseVO);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("updateTextSenseCallbackData Service DAO Error !!! " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,5 +84,19 @@ public class TextSenseServiceImpl implements TextSenseService{
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TextSense Callback 데이터 내용 업데이트 해주기
|
||||||
|
@Override
|
||||||
|
public void updateTextSenseCallbackData(TextSenseVO textSenseVO) throws Exception{
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
textSenseDAO.updateTextSenseCallbackData(textSenseVO);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("updateTextSenseCallbackData Service Impl Error !!! " + e);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,24 +34,29 @@ public class TextSenseAPIComm {
|
|||||||
String callbackUri = textSenseVO.getCallbackUri();//"http://119.193.215.98:8097/web/main/textsence/testCallbackUriPage.do";
|
String callbackUri = textSenseVO.getCallbackUri();//"http://119.193.215.98:8097/web/main/textsence/testCallbackUriPage.do";
|
||||||
//String extraJobs = "";
|
//String extraJobs = "";
|
||||||
|
|
||||||
|
JSONObject jsonOptObj = new JSONObject();
|
||||||
|
jsonOptObj.put("withoutConversion", true);
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("inputUri", inputUri);
|
jsonObject.put("inputUri", inputUri);
|
||||||
jsonObject.put("outputUri", outputUri);
|
jsonObject.put("outputUri", outputUri);
|
||||||
jsonObject.put("taskName", taskName);
|
jsonObject.put("taskName", taskName);
|
||||||
jsonObject.put("callbackUri", callbackUri);
|
jsonObject.put("callbackUri", callbackUri);
|
||||||
|
jsonObject.put("option", jsonOptObj);
|
||||||
|
|
||||||
JSONArray extraJobs = new JSONArray();
|
JSONArray extraJobs = new JSONArray();
|
||||||
JSONObject jsonJobs = new JSONObject();
|
JSONObject jsonJobs = new JSONObject();
|
||||||
|
|
||||||
JSONObject jsonOption = new JSONObject();
|
JSONObject jsonOption = new JSONObject();
|
||||||
|
|
||||||
|
|
||||||
//extraJobs의 Option 항목 셋팅 해주기
|
//extraJobs의 Option 항목 셋팅 해주기
|
||||||
jsonOption.put("url", textSenseVO.getUrl());
|
jsonOption.put("url", textSenseVO.getUrl());
|
||||||
jsonOption.put("reqType", textSenseVO.getReqType());
|
jsonOption.put("reqType", textSenseVO.getReqType());
|
||||||
jsonOption.put("reqOption", "");
|
|
||||||
|
JSONObject jsonReqOption = new JSONObject();
|
||||||
|
|
||||||
|
jsonOption.put("reqOption", jsonReqOption);
|
||||||
jsonOption.put("outputType", textSenseVO.getOutputType());
|
jsonOption.put("outputType", textSenseVO.getOutputType());
|
||||||
|
jsonOption.put("pages", "all");
|
||||||
|
|
||||||
//extraJobs 셋팅해주기
|
//extraJobs 셋팅해주기
|
||||||
jsonJobs.put("type", textSenseVO.getType());
|
jsonJobs.put("type", textSenseVO.getType());
|
||||||
@ -86,6 +91,7 @@ public class TextSenseAPIComm {
|
|||||||
|
|
||||||
returnJson = object;
|
returnJson = object;
|
||||||
returnJson.put("resultSts", "success");
|
returnJson.put("resultSts", "success");
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
returnJson.put("resultSts", "fail");
|
returnJson.put("resultSts", "fail");
|
||||||
@ -99,4 +105,61 @@ public class TextSenseAPIComm {
|
|||||||
|
|
||||||
return returnJson;
|
return returnJson;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* TextSense OCR 결과 상태 확인하기
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static JSONObject getTextSenseApiStatus(TextSenseVO textSenseVO) throws Exception{
|
||||||
|
JSONObject returnJson = new JSONObject();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String apiUrl = textSenseVO.getApiUrl();
|
||||||
|
String id = textSenseVO.getId();
|
||||||
|
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("type", "OBJECT_ID");
|
||||||
|
jsonObject.put("id", id);
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
returnJson = object;
|
||||||
|
returnJson.put("resultSts", "success");
|
||||||
|
|
||||||
|
}else {
|
||||||
|
|
||||||
|
System.out.println("statusCode ::: "+statusCode);
|
||||||
|
returnJson.put("resultSts", "fail");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("++++++++++++++++ getTextSenseRequest Error!!! "+e);
|
||||||
|
returnJson.put("resultSts", "fail");
|
||||||
|
}
|
||||||
|
|
||||||
|
return returnJson;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,104 +152,112 @@ public class TextSenseController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//첨부파일 등록 API 전송 요청
|
try {
|
||||||
final Map<String, MultipartFile> files = multiRequest.getFileMap();
|
|
||||||
String atchFileId = "";
|
|
||||||
String isThumbFile = "";
|
|
||||||
|
|
||||||
List<String> extList = new ArrayList<String>();
|
//첨부파일 등록 API 전송 요청
|
||||||
extList.add("jpg");
|
final Map<String, MultipartFile> files = multiRequest.getFileMap();
|
||||||
extList.add("jpeg");
|
String atchFileId = "";
|
||||||
extList.add("png");
|
String isThumbFile = "";
|
||||||
extList.add("tif");
|
|
||||||
extList.add("tiff");
|
|
||||||
extList.add("multi-tiff");
|
|
||||||
extList.add("pdf");
|
|
||||||
extList.add("bmp");
|
|
||||||
|
|
||||||
//알림톡 템플릿에 이미지가 포함되어 있는 경우 처리
|
List<String> extList = new ArrayList<String>();
|
||||||
if (!files.isEmpty()){
|
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 ("".equals(atchFileId)) {
|
//알림톡 템플릿에 이미지가 포함되어 있는 경우 처리
|
||||||
List<FileVO> result = fileUtil.parseFileInf(files, "TSOCR_", 0, atchFileId, "", isThumbFile);
|
if (!files.isEmpty()){
|
||||||
|
|
||||||
for(FileVO fileVO : result) {
|
if ("".equals(atchFileId)) {
|
||||||
|
List<FileVO> result = fileUtil.parseFileInf(files, "TSOCR_", 0, atchFileId, "", isThumbFile);
|
||||||
|
|
||||||
String fileExt = fileVO.getFileExtsn();
|
for(FileVO fileVO : result) {
|
||||||
|
|
||||||
//파일 확장자 체크
|
String fileExt = fileVO.getFileExtsn();
|
||||||
if(!extList.contains(fileExt)) {
|
|
||||||
|
|
||||||
modelAndView.addObject("result", "fail");
|
//파일 확장자 체크
|
||||||
return modelAndView;
|
if(!extList.contains(fileExt)) {
|
||||||
|
|
||||||
|
modelAndView.addObject("result", "fail");
|
||||||
|
return modelAndView;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//파일 정보 디비에 저장
|
||||||
|
atchFileId = fileMngService.insertFileInfs(result);
|
||||||
|
|
||||||
|
System.out.println("++++++++++++++ atchFileId ::: "+atchFileId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//파일 정보 디비에 저장
|
|
||||||
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();
|
||||||
|
|
||||||
//TextSense API 요청 처리
|
apiTextSenseVO.setApiUrl(apiUrl);
|
||||||
TextSenseVO apiTextSenseVO = new TextSenseVO();
|
apiTextSenseVO.setInputUri("http://119.193.215.98:8097/uss/ion/pwm/getImage.do?atchFileId="+ atchFileId +"&fileSn=0");
|
||||||
String outputFileNm = "ePapy_" + EgovStringUtil.getTimeStamp() + "_OCR.json";
|
apiTextSenseVO.setOutputUri("file:/home/kcc_adr_ocr_dir/" + outputFileNm);
|
||||||
String apiUrl = textSenseApiUrl + "/textsense/api/job/build";
|
apiTextSenseVO.setCallbackUri("http://119.193.215.98:8097/kccadr/textsence/textSenseCallbackUriPage.do");
|
||||||
String taskName = textSenseVO.getTaskName();
|
apiTextSenseVO.setTaskName(taskName);
|
||||||
|
|
||||||
apiTextSenseVO.setApiUrl(apiUrl);
|
//extraJobs의 Option 항목 셋팅 해주기
|
||||||
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.setUrl("http://textsense:8080");
|
||||||
apiTextSenseVO.setOutputUri("file:/home/kcc_adr_ocr_dir/" + outputFileNm);
|
apiTextSenseVO.setReqType("document"); //고정값으로 변경 불가
|
||||||
apiTextSenseVO.setCallbackUri("http://119.193.215.98:8097/kccadr/textsence/testCallbackUriPage.do");
|
//apiTextSenseVO.setReqOption("{}"); //기본값으로 빈값을 넣어준다.
|
||||||
apiTextSenseVO.setTaskName(taskName);
|
apiTextSenseVO.setOutputType("json"); //지원하는 output type은 pdf, json, excel, text, text-split 입니다
|
||||||
|
apiTextSenseVO.setType("textSense"); //고정값으로 변경 불가
|
||||||
|
|
||||||
//extraJobs의 Option 항목 셋팅 해주기
|
JSONObject resultJson = TextSenseAPIComm.getTextSenseRequest(apiTextSenseVO);
|
||||||
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);
|
//처리 결과가 성공이면 디비에 저장해주고 끝낸다.
|
||||||
|
String resultSts = resultJson.get("resultSts").toString();
|
||||||
|
if(resultSts.equals("success")) {
|
||||||
|
|
||||||
System.out.println("==========Controller============== resultJson ::: "+resultJson.toJSONString());
|
//요청 결과내용 데이터베이스에 저장
|
||||||
|
TextSenseVO resultJsVO = new TextSenseVO();
|
||||||
|
|
||||||
//처리 결과가 성공이면 디비에 저장해주고 끝낸다.
|
String id = resultJson.get("id").toString();
|
||||||
String resultSts = resultJson.get("resultSts").toString();
|
String status = resultJson.get("status").toString();
|
||||||
if(resultSts.equals("success")) {
|
|
||||||
|
|
||||||
//요청 결과내용 데이터베이스에 저장
|
taskName = resultJson.get("name").toString();
|
||||||
TextSenseVO resultJsVO = new TextSenseVO();
|
|
||||||
|
|
||||||
String id = resultJson.get("id").toString();
|
resultJsVO.setId(id);
|
||||||
String status = resultJson.get("status").toString();
|
resultJsVO.setTaskName(taskName);
|
||||||
|
resultJsVO.setStatus(status);
|
||||||
|
resultJsVO.setInputUri(apiTextSenseVO.getInputUri());
|
||||||
|
resultJsVO.setOutputUri(apiTextSenseVO.getOutputUri());
|
||||||
|
resultJsVO.setCallbackUri(apiTextSenseVO.getCallbackUri());
|
||||||
|
resultJsVO.setFrstRegisterId(user.getId());
|
||||||
|
|
||||||
taskName = resultJson.get("name").toString();
|
int resultCnt = textSenseService.insertTextSenseRequestResultInfo(resultJsVO);
|
||||||
|
|
||||||
resultJsVO.setId(id);
|
System.out.println("+++++++++++++++++ resultCnt ::: "+resultCnt);
|
||||||
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);
|
modelAndView.addObject("result", "success");
|
||||||
|
modelAndView.addObject("id", id);
|
||||||
|
modelAndView.addObject("name", taskName);
|
||||||
|
modelAndView.addObject("status", status);
|
||||||
|
|
||||||
System.out.println("+++++++++++++++++ resultCnt ::: "+resultCnt);
|
}else {
|
||||||
|
|
||||||
modelAndView.addObject("result", "success");
|
modelAndView.addObject("result", "fail");
|
||||||
modelAndView.addObject("id", id);
|
|
||||||
modelAndView.addObject("name", taskName);
|
|
||||||
modelAndView.addObject("status", status);
|
|
||||||
|
|
||||||
}else {
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("textSenseRequest Controller Error !!!!" + e);
|
||||||
|
|
||||||
modelAndView.addObject("result", "fail");
|
modelAndView.addObject("result", "fail");
|
||||||
|
return modelAndView;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,56 +265,127 @@ public class TextSenseController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value="/kccadr/textsence/testCallbackUriPage.do")
|
|
||||||
public void testCallbackUriPage(HttpServletRequest req, HttpServletResponse res, @RequestBody JSONObject jsonObject) throws Exception{
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* TextSense 결과 Callback 정보 전달
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
@RequestMapping(value="/kccadr/textsence/textSenseCallbackUriPage.do")
|
||||||
|
public void textSenseCallbackUriPage(HttpServletRequest req, HttpServletResponse res, @RequestBody JSONObject jsonObject) throws Exception{
|
||||||
|
|
||||||
System.out.println("++++++++++++++++++++++++++/web/main/textsence/testCallbackUriPage.do++++++++++++++++++++++++++++++++++");
|
System.out.println("++++++++++++++++++++++++++/web/main/textsence/testCallbackUriPage.do++++++++++++++++++++++++++++++++++");
|
||||||
|
|
||||||
System.out.println("+++++++++++ jsonString ::: "+jsonObject.toJSONString());
|
System.out.println("+++++++++++ jsonString ::: "+jsonObject.toJSONString());
|
||||||
|
|
||||||
JSONParser parser = new JSONParser();
|
try {
|
||||||
Object obj = parser.parse(jsonObject.toString());
|
|
||||||
JSONObject object = (JSONObject) obj;
|
|
||||||
|
|
||||||
String id = object.get("id").toString();
|
JSONParser parser = new JSONParser();
|
||||||
String name = object.get("name").toString();
|
Object obj = parser.parse(jsonObject.toString());
|
||||||
String inputUri = object.get("inputUri").toString();
|
JSONObject object = (JSONObject) obj;
|
||||||
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();
|
|
||||||
|
|
||||||
|
String id = object.get("id").toString();
|
||||||
|
String name = object.get("name").toString();
|
||||||
|
String inputUri = object.get("inputUri").toString();
|
||||||
|
String outputUri = object.get("outputUri").toString();
|
||||||
|
String status = object.get("status").toString();
|
||||||
|
String callbackUri = object.get("callbackUri").toString();
|
||||||
|
String inputFileLength = object.get("inputFileLength").toString();
|
||||||
|
String outputFileLength = object.get("outputFileLength").toString();
|
||||||
|
String createdAt = (object.get("createdAt") == null ? "0" : object.get("createdAt").toString());
|
||||||
|
String queuedAt = (object.get("queuedAt") == null ? "0" : object.get("queuedAt").toString());
|
||||||
|
String startedAt = (object.get("startedAt") == null ? "0" : object.get("startedAt").toString());
|
||||||
|
String completedAt = (object.get("completedAt") == null ? "0" : object.get("completedAt").toString());
|
||||||
|
String updatedAt = (object.get("updatedAt") == null ? "0" : object.get("updatedAt").toString());
|
||||||
|
String maxRetryCount = (object.get("maxRetryCount") == null ? "0" : object.get("maxRetryCount").toString());
|
||||||
|
String retryCount = (object.get("retryCount") == null ? "0" : object.get("retryCount").toString());
|
||||||
|
String collectedBy = (object.get("collectedBy") == null ? null : object.get("collectedBy").toString());
|
||||||
|
|
||||||
System.out.println("+++++++++++++++++++++++ id ::: "+id);
|
TextSenseVO textSenseVO = new TextSenseVO();
|
||||||
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);
|
|
||||||
|
|
||||||
|
textSenseVO.setId(id);
|
||||||
|
textSenseVO.setTaskName(name);
|
||||||
|
textSenseVO.setInputUri(inputUri);
|
||||||
|
textSenseVO.setInputFileLength(inputFileLength);
|
||||||
|
textSenseVO.setOutputUri(outputUri);
|
||||||
|
textSenseVO.setOutputFileLength(outputFileLength);
|
||||||
|
textSenseVO.setStatus(status);
|
||||||
|
textSenseVO.setCreatedat(createdAt);
|
||||||
|
textSenseVO.setQueuedat(queuedAt);
|
||||||
|
textSenseVO.setStartedat(startedAt);
|
||||||
|
textSenseVO.setCompletedat(completedAt);
|
||||||
|
textSenseVO.setUpdatedat(updatedAt);
|
||||||
|
textSenseVO.setMaxRetryCount(maxRetryCount);
|
||||||
|
textSenseVO.setMaxRetryCount(maxRetryCount);
|
||||||
|
textSenseVO.setCollectedby(collectedBy);
|
||||||
|
textSenseVO.setCallbackUri(callbackUri);
|
||||||
|
|
||||||
|
//callback 결과 내용 디비 업데이터 처리 해주기
|
||||||
|
textSenseService.updateTextSenseCallbackData(textSenseVO);
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("textSenseCallbackUriPage Controller Error !!! " + e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TextSense 요청 결과 상태값
|
||||||
|
* SUCCESS: 작업이 성공하여 완료된 상태입니다.
|
||||||
|
* FAILURE: 작업중 오류가 발생하여 실패한 상태입니다.
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
@RequestMapping(value="/kccadr/textsence/textSenseApiStatus.do")
|
||||||
|
public ModelAndView textSenseApiStatus(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;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String apiUrl = textSenseApiUrl + "/textsense/api/job/status";
|
||||||
|
textSenseVO.setApiUrl(apiUrl);
|
||||||
|
|
||||||
|
JSONObject resultJson = TextSenseAPIComm.getTextSenseApiStatus(textSenseVO);
|
||||||
|
|
||||||
|
String resultStatus = resultJson.get("status").toString();
|
||||||
|
|
||||||
|
modelAndView.addObject("result", "success");
|
||||||
|
modelAndView.addObject("textSenseSts", resultStatus);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println("textSenseApiStatus Controller Error !!! " + e);
|
||||||
|
modelAndView.addObject("result", "fail");
|
||||||
|
return modelAndView;
|
||||||
|
}
|
||||||
|
|
||||||
|
return modelAndView;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@
|
|||||||
A.TASK_NAME AS taskName,
|
A.TASK_NAME AS taskName,
|
||||||
A.INPUT_URI AS inputUri,
|
A.INPUT_URI AS inputUri,
|
||||||
A.OUTPUT_URI AS outputUri,
|
A.OUTPUT_URI AS outputUri,
|
||||||
A.INPUT_FILE_LENGTH AS inputFileLenth,
|
A.INPUT_FILE_LENGTH AS inputFileLength,
|
||||||
A.OUTPUT_FILE_LENGTH AS outputfileLength,
|
A.OUTPUT_FILE_LENGTH AS outputfileLength,
|
||||||
A.STATUS AS status,
|
A.STATUS AS status,
|
||||||
A.CREATEDAT AS createdat,
|
A.CREATEDAT AS createdat,
|
||||||
@ -88,12 +88,12 @@
|
|||||||
A.TASK_NAME AS taskName,
|
A.TASK_NAME AS taskName,
|
||||||
A.INPUT_URI AS inputUri,
|
A.INPUT_URI AS inputUri,
|
||||||
A.OUTPUT_URI AS outputUri,
|
A.OUTPUT_URI AS outputUri,
|
||||||
A.INPUT_FILE_LENGTH AS inputFileLenth,
|
A.INPUT_FILE_LENGTH AS inputFileLength,
|
||||||
A.OUTPUT_FILE_LENGTH AS outputFileLenth,
|
A.OUTPUT_FILE_LENGTH AS outputFileLength,
|
||||||
A.STATUS AS status,
|
A.STATUS AS status,
|
||||||
A.CREATEDAT AS createdat,
|
A.CREATEDAT AS createdat,
|
||||||
A.QUEUEDAT AS queuedat,
|
A.QUEUEDAT AS queuedat,
|
||||||
A.STARTEDAT AS startdat,
|
A.STARTEDAT AS startedat,
|
||||||
A.COMPLETEDAT AS completedat,
|
A.COMPLETEDAT AS completedat,
|
||||||
A.UPDATEDAT AS updatedat,
|
A.UPDATEDAT AS updatedat,
|
||||||
A.MAX_RETRY_COUNT AS maxRetryCount,
|
A.MAX_RETRY_COUNT AS maxRetryCount,
|
||||||
@ -111,4 +111,25 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="textSenseDAO.updateTextSenseCallbackData" parameterClass="TextSenseVO">
|
||||||
|
|
||||||
|
UPDATE ADR_TEXTSENSE_OCR SET
|
||||||
|
STATUS = #status#
|
||||||
|
, INPUT_FILE_LENGTH = #inputFileLength#
|
||||||
|
, OUTPUT_FILE_LENGTH = #outputFileLength#
|
||||||
|
, CREATEDAT = #createdat#
|
||||||
|
, QUEUEDAT = #queuedat#
|
||||||
|
, STARTEDAT = #startedat#
|
||||||
|
, COMPLETEDAT = #completedat#
|
||||||
|
, UPDATEDAT = #updatedat#
|
||||||
|
, MAX_RETRY_COUNT = #maxRetryCount#
|
||||||
|
, RETRY_COUNT = #retryCount#
|
||||||
|
, COLLECEDBY = #collectedby#
|
||||||
|
, EXTERNAL_ID = #externalId#
|
||||||
|
WHERE ID = #id#
|
||||||
|
AND TASK_NAME = #taskName#
|
||||||
|
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
</sqlMap>
|
</sqlMap>
|
||||||
@ -107,8 +107,8 @@ function fnListPage(){
|
|||||||
<th>Input 파일 길이</th>
|
<th>Input 파일 길이</th>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${not empty textSenseVO.inputFileLenth}">
|
<c:when test="${not empty textSenseVO.inputFileLength}">
|
||||||
<c:out value="${textSenseVO.inputFileLenth}"/>
|
<c:out value="${textSenseVO.inputFileLength}"/>
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
-
|
-
|
||||||
@ -121,8 +121,8 @@ function fnListPage(){
|
|||||||
<th>Output 파일 길이</th>
|
<th>Output 파일 길이</th>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${not empty textSenseVO.outputFileLenth}">
|
<c:when test="${not empty textSenseVO.outputFileLength}">
|
||||||
<c:out value="${textSenseVO.outputFileLenth}"/>
|
<c:out value="${textSenseVO.outputFileLength}"/>
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
-
|
-
|
||||||
@ -177,8 +177,8 @@ function fnListPage(){
|
|||||||
<th>변환작업 시작 시간</th>
|
<th>변환작업 시작 시간</th>
|
||||||
<td colspan="3">
|
<td colspan="3">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${not empty textSenseVO.startdat}">
|
<c:when test="${not empty textSenseVO.startedat}">
|
||||||
<c:out value="${textSenseVO.startdat}"/>
|
<c:out value="${textSenseVO.startedat}"/>
|
||||||
</c:when>
|
</c:when>
|
||||||
<c:otherwise>
|
<c:otherwise>
|
||||||
-
|
-
|
||||||
|
|||||||
@ -59,6 +59,63 @@ function goTextSenseDetail(id){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fncTextSenseStatus(id){
|
||||||
|
|
||||||
|
var form = document.listForm;
|
||||||
|
form.id.value = id;
|
||||||
|
|
||||||
|
var data = new FormData(form);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
enctype: 'multipart/form-data',
|
||||||
|
url: "/kccadr/textsence/textSenseApiStatus.do",
|
||||||
|
data: data,
|
||||||
|
dataType:'json',
|
||||||
|
async: false,
|
||||||
|
processData: false,
|
||||||
|
contentType: false,
|
||||||
|
cache: false,
|
||||||
|
success: function (returnData, status) {
|
||||||
|
if(status == 'success'){
|
||||||
|
var result = returnData.result;
|
||||||
|
var textSenseSts = returnData.textSenseSts;
|
||||||
|
|
||||||
|
if(result == 'loginFail'){
|
||||||
|
|
||||||
|
alert("로그인이 필요합니다.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else if(result == 'success'){
|
||||||
|
|
||||||
|
if(textSenseSts == 'SUCCESS'){
|
||||||
|
|
||||||
|
alert("OCR 변환이 정상적으로 처리되었습니다.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
alert("OCR 변환이 정상적으로 처리되지 못하였습니다.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
alert("상태확인에 오류가 발생하였습니다.");
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else if(status== 'fail'){
|
||||||
|
alert("상태 확인에 실패하였습니다.");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
error: function (e) { alert("상태 확인에 실패하였습니다."); console.log("ERROR : ", e); }
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<title>OCR 목록</title>
|
<title>OCR 목록</title>
|
||||||
@ -114,19 +171,21 @@ function goTextSenseDetail(id){
|
|||||||
<col style="width: 5%">
|
<col style="width: 5%">
|
||||||
<col style="width: auto">
|
<col style="width: auto">
|
||||||
<col style="width: 10%">
|
<col style="width: 10%">
|
||||||
|
<col style="width: 10%">
|
||||||
<col style="width: 20%">
|
<col style="width: 20%">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>번호<button class="sort btn_sort" id="sort_id"></button></th>
|
<th>번호<button class="sort btn_sort" id="sort_id"></button></th>
|
||||||
<th>TaskName<button type="button" class="sort sortBtn" id="sort_taskName"></button></th>
|
<th>TaskName<button type="button" class="sort sortBtn" id="sort_taskName"></button></th>
|
||||||
|
<th>상태확인</th>
|
||||||
<th>처리상태<button type="button" class="sort sortBtn" id="sort_status"></button></th>
|
<th>처리상태<button type="button" class="sort sortBtn" id="sort_status"></button></th>
|
||||||
<th>등록일자<button type="button" class="sort sortBtn" id="sort_frstRegistPnttm"></button></th>
|
<th>등록일자<button type="button" class="sort sortBtn" id="sort_frstRegistPnttm"></button></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<c:forEach var="list" items="${list}" varStatus="status">
|
<c:forEach var="list" items="${list}" varStatus="status">
|
||||||
<tr onclick="javascript:goTextSenseDetail('<c:out value="${list.id}"/>');" style="cursor:pointer;">
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<c:if test="${searchVO.searchSortOrd eq 'desc' }">
|
<c:if test="${searchVO.searchSortOrd eq 'desc' }">
|
||||||
<c:out value="${ ( paginationInfo.totalRecordCount - ((searchVO.pageIndex -1)*searchVO.pageUnit) ) - status.index }"/>
|
<c:out value="${ ( paginationInfo.totalRecordCount - ((searchVO.pageIndex -1)*searchVO.pageUnit) ) - status.index }"/>
|
||||||
@ -135,8 +194,9 @@ function goTextSenseDetail(id){
|
|||||||
<c:out value="${(searchVO.pageIndex - 1) * searchVO.pageUnit + status.count}"/>
|
<c:out value="${(searchVO.pageIndex - 1) * searchVO.pageUnit + status.count}"/>
|
||||||
</c:if>
|
</c:if>
|
||||||
</td>
|
</td>
|
||||||
<td><c:out value="${list.taskName}"/></td>
|
<td onclick="javascript:goTextSenseDetail('<c:out value="${list.id}"/>');" style="cursor:pointer;"><c:out value="${list.taskName}"/></td>
|
||||||
<td>
|
<td><button class="btnType02" onclick="fncTextSenseStatus('<c:out value="${list.id}"/>'); return false;">상태확인</button></td>
|
||||||
|
<td onclick="javascript:goTextSenseDetail('<c:out value="${list.id}"/>');" style="cursor:pointer;">
|
||||||
<c:choose>
|
<c:choose>
|
||||||
<c:when test="${list.status eq 'AWAITING'}">
|
<c:when test="${list.status eq 'AWAITING'}">
|
||||||
변환중
|
변환중
|
||||||
@ -149,7 +209,7 @@ function goTextSenseDetail(id){
|
|||||||
</c:otherwise>
|
</c:otherwise>
|
||||||
</c:choose>
|
</c:choose>
|
||||||
</td>
|
</td>
|
||||||
<td><c:out value="${list.frstRegistPnttm}"/></td>
|
<td onclick="javascript:goTextSenseDetail('<c:out value="${list.id}"/>');" style="cursor:pointer;"><c:out value="${list.frstRegistPnttm}"/></td>
|
||||||
</tr>
|
</tr>
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
<c:if test="${empty list}">
|
<c:if test="${empty list}">
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user