Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
托
托幼费报销
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JAVA
托幼费报销
Commits
353a0844
Commit
353a0844
authored
6 months ago
by
ah_zjn
Browse files
Options
Downloads
Patches
Plain Diff
ocr识别接口调整
parent
43478a52
Branches
feature/zhaojinnan
Branches containing commit
1 merge request
!111
ocr识别接口调整
Pipeline
#166084
failed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ServiceSiteCommon/src/main/java/com/seasky/nurseryFeesclaims/business/service/CommServiceImpl.java
+20
-2
20 additions, 2 deletions
...y/nurseryFeesclaims/business/service/CommServiceImpl.java
with
20 additions
and
2 deletions
ServiceSiteCommon/src/main/java/com/seasky/nurseryFeesclaims/business/service/CommServiceImpl.java
+
20
−
2
View file @
353a0844
...
...
@@ -492,14 +492,32 @@ public class CommServiceImpl implements CommService {
return
null
;
}
log
.
info
(
"调用OCR接口..."
);
/** 接口停用 2024年12月18日
JSONObject jsonObject = new JSONObject();
jsonObject.put("file_url", url);
String result = HttpRequest.post(ocrUrl).contentType("application/json; charset=UTF-8").timeout(1000 * 60 * 10).setConnectionTimeout(1000 * 60 * 10).body(jsonObject.toString()).execute().body();
//String result= HttpUtils.doPost(ocrUrl,jsonObject.toString());
*/
//OCR文档处理(新)
//API: https://admin.aiagentsflow.com/document/ocr
//示例参数(body): { "file_list": [ { "file_id": "test", "file_url": "http://", "file_base64": "" } ], "return_horizontal_base64": "", "return_image_base64": "", "image_enhance": "" }
JSONObject
ocrParam
=
new
JSONObject
();
JSONArray
file_list
=
new
JSONArray
();
JSONObject
file
=
new
JSONObject
();
file
.
put
(
"file_id"
,
childCareFeeFilesEntity
.
getFileName
());
file
.
put
(
"file_url"
,
url
);
file
.
put
(
"file_base64"
,
""
);
file_list
.
add
(
file
);
ocrParam
.
put
(
"file_list"
,
file_list
);
ocrParam
.
put
(
"return_horizontal_base64"
,
false
);
ocrParam
.
put
(
"return_image_base64"
,
false
);
ocrParam
.
put
(
"image_enhance"
,
false
);
log
.
info
(
"OCR接口 入参:..."
+
ocrParam
.
toString
());
String
result
=
HttpRequest
.
post
(
ocrUrl
).
contentType
(
"application/json; charset=UTF-8"
).
timeout
(
1000
*
60
*
10
).
setConnectionTimeout
(
1000
*
60
*
10
).
body
(
ocrParam
.
toString
()).
execute
().
body
();
log
.
info
(
"OCR接口 返回信息:..."
+
result
);
JSONObject
recognizeOutResult
=
JSONObject
.
parseObject
(
result
);
if
(
recognizeOutResult
.
get
(
"code"
).
equals
(
200
))
{
String
content
=
recognizeOutResult
.
get
(
"content"
).
toString
();
//String content = recognizeOutResult.get("content").toString();
String
content
=
recognizeOutResult
.
getJSONArray
(
"data"
).
getJSONObject
(
0
).
getString
(
"file_content"
);
oCRLogEntity
.
setResult
(
content
);
this
.
ocrLogMapper
.
insert
(
oCRLogEntity
);
return
content
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment