OCR识别-调用外部服务
This commit is contained in:
+16
-3
@@ -2,17 +2,17 @@ package com.jero.modules.ocr.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.FeignClient.LocalToolFeignClient;
|
||||
import com.jero.modules.ocr.entity.OcrRecordEO;
|
||||
import com.jero.modules.ocr.entity.OcrResultEO;
|
||||
import com.jero.modules.ocr.service.IOcrRecordEOService;
|
||||
import com.jero.modules.ocr.service.IOcrRestfulService;
|
||||
import com.jero.modules.ocr.util.Base64Util;
|
||||
import com.jero.modules.ocr.util.RsaUtil;
|
||||
import com.jero.modules.system.vo.OcrVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpEntity;
|
||||
@@ -46,6 +46,8 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private LocalToolFeignClient localToolFeignClient;
|
||||
|
||||
@Autowired
|
||||
private IOcrRecordEOService ocrRecordEOService;
|
||||
@@ -113,7 +115,18 @@ public class OcrRestfulServiceImpl implements IOcrRestfulService {
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
log.info("处理完文件数据,开始请求OCR接口数据:【"+sdf.format(new Date())+"】");
|
||||
try{
|
||||
ResponseEntity<String> responseEntity = restTemplate.postForEntity(RestHandleFileUrl, httpEntity, String.class);
|
||||
// ResponseEntity<String> responseEntity = restTemplate.postForEntity(RestHandleFileUrl, httpEntity, String.class);
|
||||
OcrVO ocrVO = new OcrVO();
|
||||
ocrVO.setRestHandleFileUrl(RestHandleFileUrl);
|
||||
ocrVO.setOcrUserId(OcrUserId);
|
||||
ocrVO.setAuthCode(authCode);
|
||||
ocrVO.setConvertType(convertType);
|
||||
ocrVO.setFileName(fileName);
|
||||
ocrVO.setFileContent(fileContent);
|
||||
ocrVO.setTaskId(taskId);
|
||||
ocrVO.setRestCallBackUrl(RestCallBackUrl);
|
||||
ResponseEntity<String> responseEntity = localToolFeignClient.getFile(ocrVO);
|
||||
|
||||
log.info("请求OCR接口完毕,返回响应状态:【"+sdf.format(new Date())+"】");
|
||||
HttpStatus statusCode = responseEntity.getStatusCode();
|
||||
if(statusCode != HttpStatus.OK){
|
||||
|
||||
+13
-13
@@ -19,7 +19,7 @@
|
||||
|
||||
<!-- SAR_FILE_SPLIT_MENU table all fields -->
|
||||
<sql id="Base_Column_List" >
|
||||
id, info_id, name, p_id, display_seq, valid_flag, creation_time, modify_time, remarks, creation_user, modify_user,item_name
|
||||
id, info_id, name, parent_id, display_seq, valid_flag, creation_time, modify_time, remarks, creation_user, modify_user,item_name
|
||||
</sql>
|
||||
|
||||
<!-- 查询条件 -->
|
||||
@@ -36,7 +36,7 @@
|
||||
and name ${nameOperator} #{name}
|
||||
</if>
|
||||
<if test="pId != null" >
|
||||
and p_id ${pIdOperator} #{pId}
|
||||
and parent_id ${pIdOperator} #{pId}
|
||||
</if>
|
||||
<if test="displaySeq != null" >
|
||||
and display_seq ${displaySeqOperator} #{displaySeq}
|
||||
@@ -93,7 +93,7 @@
|
||||
<if test="id != null" >id,</if>
|
||||
<if test="infoId != null" >info_id,</if>
|
||||
<if test="name != null" >name,</if>
|
||||
<if test="pId != null" >p_id,</if>
|
||||
<if test="pId != null" >parent_id,</if>
|
||||
<if test="displaySeq != null" >display_seq,</if>
|
||||
<if test="validFlag != null" >valid_flag,</if>
|
||||
<if test="creationTime != null" >creation_time,</if>
|
||||
@@ -124,7 +124,7 @@
|
||||
update SAR_FILE_SPLIT_MENU
|
||||
set info_id = #{infoId},
|
||||
name = #{name},
|
||||
p_id = #{pId},
|
||||
parent_id = #{pId},
|
||||
display_seq = #{displaySeq},
|
||||
valid_flag = #{validFlag},
|
||||
creation_time = #{creationTime},
|
||||
@@ -146,7 +146,7 @@
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="pId != null" >
|
||||
p_id = #{pId},
|
||||
parent_id = #{pId},
|
||||
</if>
|
||||
<if test="displaySeq != null" >
|
||||
display_seq = #{displaySeq},
|
||||
@@ -265,29 +265,29 @@
|
||||
<select id="queryByPidExcpetSelf" resultMap="BaseResultMap" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO">
|
||||
select SAR_FILE_SPLIT_MENU.* from SAR_FILE_SPLIT_MENU
|
||||
where valid_flag=0 and id != #{id}
|
||||
start with id=#{id} connect by prior id= p_id
|
||||
start with id=#{id} connect by prior id= parent_id
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPId" parameterType="java.lang.String">
|
||||
delete from SAR_FILE_SPLIT_MENU where id in (
|
||||
select id from SAR_FILE_SPLIT_MENU start with id=#{id} connect by prior id= p_id
|
||||
select id from SAR_FILE_SPLIT_MENU start with id=#{id} connect by prior id= parent_id
|
||||
)
|
||||
|
||||
</delete>
|
||||
|
||||
<select id="getMaxDisplayByid" resultType="java.lang.Integer" parameterType="com.jero.modules.split.common.BasePage">
|
||||
SELECT max(SAR_FILE_SPLIT_MENU.DISPLAY_SEQ) FROM
|
||||
SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = p_id
|
||||
SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = parent_id
|
||||
</select>
|
||||
|
||||
<select id="getMaxDisplayByidNextLevel" resultType="java.lang.Integer" parameterType="java.lang.String">
|
||||
SELECT max(SAR_FILE_SPLIT_MENU.DISPLAY_SEQ) FROM
|
||||
SAR_FILE_SPLIT_MENU where P_ID = #{id}
|
||||
SAR_FILE_SPLIT_MENU where parent_id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getChildrenCountByParentId" resultType="java.lang.Integer" parameterType="com.jero.modules.split.common.BasePage">
|
||||
SELECT count(*) FROM
|
||||
SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = p_id
|
||||
SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = parent_id
|
||||
</select>
|
||||
|
||||
<update id="updateChildrenDisplaySeqByIDAdd" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
@@ -296,7 +296,7 @@
|
||||
modify_time = #{modifyTime},
|
||||
modify_user = #{modifyUser}
|
||||
where id in ( SELECT id FROM
|
||||
SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = p_id)
|
||||
SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = parent_id)
|
||||
</update>
|
||||
|
||||
<update id="updateChildrenDisplaySeqByIDCut" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO" >
|
||||
@@ -305,13 +305,13 @@
|
||||
modify_time = #{modifyTime},
|
||||
modify_user = #{modifyUser}
|
||||
where id in ( SELECT id FROM
|
||||
SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = p_id)
|
||||
SAR_FILE_SPLIT_MENU START WITH id = #{id} CONNECT BY PRIOR id = parent_id)
|
||||
</update>
|
||||
|
||||
<select id="queryAllChildrenByid" resultMap="BaseResultMap" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO">
|
||||
select SAR_FILE_SPLIT_MENU.* from SAR_FILE_SPLIT_MENU
|
||||
where valid_flag=0
|
||||
start with id=#{id} connect by prior id= p_id
|
||||
start with id=#{id} connect by prior id= parent_id
|
||||
</select>
|
||||
|
||||
<delete id="deleteByIdList" parameterType="java.util.List">
|
||||
|
||||
Reference in New Issue
Block a user