Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
ocrCloudPlatForm
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ocr-cloud-platform
ocrCloudPlatForm
Commits
b1c592cb
Commit
b1c592cb
authored
Jan 26, 2024
by
黄明步
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
e3208b5f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
39 deletions
+63
-39
pom.xml
+0
-7
src/main/java/com/gxmailu/ocrCloudPlatform/controller/AppAbilityRecordAllController.java
+3
-0
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/ElasticSearchService.java
+8
-17
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/RetransmissionService.java
+12
-10
src/main/java/com/gxmailu/ocrCloudPlatform/vo/OcrResult.java
+1
-1
src/main/resources/application-dev.yml
+4
-4
src/test/java/com/gxmailu/ocrCloudPlatform/ESTest.java
+35
-0
No files found.
pom.xml
View file @
b1c592cb
...
@@ -186,13 +186,6 @@
...
@@ -186,13 +186,6 @@
<artifactId>
druid-spring-boot-starter
</artifactId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
${alibaba.druid.version}
</version>
<version>
${alibaba.druid.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<groupId>
com.alibaba
</groupId>
<artifactId>
easyexcel
</artifactId>
<artifactId>
easyexcel
</artifactId>
...
...
src/main/java/com/gxmailu/ocrCloudPlatform/controller/AppAbilityRecordAllController.java
View file @
b1c592cb
...
@@ -74,6 +74,9 @@ public class AppAbilityRecordAllController {
...
@@ -74,6 +74,9 @@ public class AppAbilityRecordAllController {
}
}
System
.
out
.
println
(
"yearMonthDay=========="
+
yearMonthDay
+
";endYearMonthDay=========="
+
endYearMonthDay
);
System
.
out
.
println
(
"yearMonthDay=========="
+
yearMonthDay
+
";endYearMonthDay=========="
+
endYearMonthDay
);
}
else
{
yearMonthDay
=
DateUtil
.
parse
(
"2014-01-01 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
).
toString
();
endYearMonthDay
=
DateUtil
.
parse
(
DateUtil
.
date
().
toString
(),
"yyyy-MM-dd HH:mm:ss"
).
toString
();
}
}
try
{
try
{
List
<
CallRecordModel
>
callRecordList
=
this
.
recordAllService
.
selectCallRecord
(
yearMonthDay
,
endYearMonthDay
);
List
<
CallRecordModel
>
callRecordList
=
this
.
recordAllService
.
selectCallRecord
(
yearMonthDay
,
endYearMonthDay
);
...
...
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/ElasticSearchService.java
View file @
b1c592cb
...
@@ -14,7 +14,6 @@ import co.elastic.clients.elasticsearch._types.FieldValue;
...
@@ -14,7 +14,6 @@ import co.elastic.clients.elasticsearch._types.FieldValue;
import
co.elastic.clients.elasticsearch._types.SortOrder
;
import
co.elastic.clients.elasticsearch._types.SortOrder
;
import
co.elastic.clients.elasticsearch._types.aggregations.*
;
import
co.elastic.clients.elasticsearch._types.aggregations.*
;
import
co.elastic.clients.elasticsearch.core.*
;
import
co.elastic.clients.elasticsearch.core.*
;
import
co.elastic.clients.elasticsearch.core.bulk.BulkResponseItem
;
import
co.elastic.clients.elasticsearch.core.search.TotalHits
;
import
co.elastic.clients.elasticsearch.core.search.TotalHits
;
import
co.elastic.clients.elasticsearch.indices.DeleteIndexResponse
;
import
co.elastic.clients.elasticsearch.indices.DeleteIndexResponse
;
import
co.elastic.clients.json.JsonData
;
import
co.elastic.clients.json.JsonData
;
...
@@ -26,6 +25,7 @@ import com.gxmailu.ocrCloudPlatform.entity.*;
...
@@ -26,6 +25,7 @@ import com.gxmailu.ocrCloudPlatform.entity.*;
import
com.gxmailu.ocrCloudPlatform.excel.model.CallRecordModel
;
import
com.gxmailu.ocrCloudPlatform.excel.model.CallRecordModel
;
import
com.gxmailu.ocrCloudPlatform.mapper.AppAbilityRecordAllMapper
;
import
com.gxmailu.ocrCloudPlatform.mapper.AppAbilityRecordAllMapper
;
import
com.gxmailu.ocrCloudPlatform.mapper.ServerInfoMapper
;
import
com.gxmailu.ocrCloudPlatform.mapper.ServerInfoMapper
;
import
com.gxmailu.ocrCloudPlatform.mapper.TmpRecordByTriggerMapper
;
import
com.gxmailu.ocrCloudPlatform.service.ConfigAbilityService
;
import
com.gxmailu.ocrCloudPlatform.service.ConfigAbilityService
;
import
com.gxmailu.ocrCloudPlatform.service.ConfigApplicationService
;
import
com.gxmailu.ocrCloudPlatform.service.ConfigApplicationService
;
import
com.gxmailu.ocrCloudPlatform.service.CourtService
;
import
com.gxmailu.ocrCloudPlatform.service.CourtService
;
...
@@ -55,11 +55,13 @@ public class ElasticSearchService {
...
@@ -55,11 +55,13 @@ public class ElasticSearchService {
private
static
final
Map
<
Character
,
String
>
SPECIAL_CHARACTERS_MAP
=
new
HashMap
<>();
private
static
final
Map
<
Character
,
String
>
SPECIAL_CHARACTERS_MAP
=
new
HashMap
<>();
private
static
String
lastIndexTime
=
"202
3-05-11 07
:00:00"
;
private
static
String
lastIndexTime
=
"202
4-01-23 08
:00:00"
;
@Resource
@Resource
private
AppAbilityRecordAllMapper
recordAllMapper
;
private
AppAbilityRecordAllMapper
recordAllMapper
;
@Resource
@Resource
private
TmpRecordByTriggerMapper
tmpRecordByTriggerMapper
;
@Resource
private
ServerInfoMapper
serverInfoMapper
;
private
ServerInfoMapper
serverInfoMapper
;
@Resource
@Resource
private
ConfigAbilityService
configAbilityService
;
private
ConfigAbilityService
configAbilityService
;
...
@@ -104,7 +106,7 @@ public class ElasticSearchService {
...
@@ -104,7 +106,7 @@ public class ElasticSearchService {
return
response
.
source
();
return
response
.
source
();
}
}
public
List
<
Map
.
Entry
<
String
,
String
>>
recordDataImport
(
List
<
AppAbilityRecord
>
appAbilityRecordList
)
{
public
void
recordDataImport
(
List
<
AppAbilityRecord
>
appAbilityRecordList
)
{
if
(
CollUtil
.
isNotEmpty
(
appAbilityRecordList
))
{
if
(
CollUtil
.
isNotEmpty
(
appAbilityRecordList
))
{
BulkRequest
.
Builder
br
=
new
BulkRequest
.
Builder
();
BulkRequest
.
Builder
br
=
new
BulkRequest
.
Builder
();
...
@@ -115,18 +117,9 @@ public class ElasticSearchService {
...
@@ -115,18 +117,9 @@ public class ElasticSearchService {
try
{
try
{
response
=
client
.
bulk
(
br
.
build
());
response
=
client
.
bulk
(
br
.
build
());
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
if
(
response
.
errors
())
{
log
.
error
(
"AppAbilityRecord数据导入失败,错误信息:{}"
,
response
);
log
.
error
(
"AppAbilityRecord数据导入失败,错误信息:{}"
,
response
);
return
new
ArrayList
<>();
}
}
List
<
BulkResponseItem
>
items
=
response
.
items
();
Map
<
String
,
String
>
map
=
items
.
stream
().
collect
(
Collectors
.
toMap
(
BulkResponseItem:
:
id
,
BulkResponseItem:
:
result
));
return
new
ArrayList
<>(
map
.
entrySet
());
}
}
return
new
ArrayList
<>();
}
}
...
@@ -246,8 +239,6 @@ public class ElasticSearchService {
...
@@ -246,8 +239,6 @@ public class ElasticSearchService {
// 日期范围查询
// 日期范围查询
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
.
field
(
"callTime"
)
.
field
(
"callTime"
)
// .from(startTime)
// .to(endTime)
.
gte
(
JsonData
.
of
(
startTime
))
.
gte
(
JsonData
.
of
(
startTime
))
.
lt
(
JsonData
.
of
(
endTime
))
.
lt
(
JsonData
.
of
(
endTime
))
));
));
...
@@ -276,9 +267,9 @@ public class ElasticSearchService {
...
@@ -276,9 +267,9 @@ public class ElasticSearchService {
String
startTime
=
lastIndexTime
;
String
startTime
=
lastIndexTime
;
String
endTime
=
""
;
String
endTime
=
""
;
while
(!
DateUtil
.
parse
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
).
after
(
new
Date
()))
{
while
(!
DateUtil
.
parse
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
).
after
(
new
Date
()))
{
endTime
=
DateUtil
.
offset
Hour
(
DateUtil
.
parse
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
),
2
).
toString
(
"yyyy-MM-dd HH:mm:ss"
);
endTime
=
DateUtil
.
offset
Minute
(
DateUtil
.
parse
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
),
20
).
toString
(
"yyyy-MM-dd HH:mm:ss"
);
List
<
AppAbilityRecordAll
>
documentList
=
recordAllMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
AppAbilityRecordAll
.
class
).
between
(
AppAbilityRecordAll
:
:
getCallTime
,
startTime
,
endTime
));
List
<
TmpRecordByTrigger
>
documentList
=
tmpRecordByTriggerMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
TmpRecordByTrigger
.
class
).
between
(
TmpRecordByTrigger
:
:
getCallTime
,
startTime
,
endTime
));
documentList
=
documentList
.
stream
().
sorted
(
Comparator
.
comparing
(
AppAbilityRecordAll
:
:
getCallTime
)).
collect
(
Collectors
.
toList
());
documentList
=
documentList
.
stream
().
sorted
(
Comparator
.
comparing
(
TmpRecordByTrigger
:
:
getCallTime
)).
collect
(
Collectors
.
toList
());
if
(
CollUtil
.
isNotEmpty
(
documentList
))
{
if
(
CollUtil
.
isNotEmpty
(
documentList
))
{
BulkRequest
.
Builder
br
=
new
BulkRequest
.
Builder
();
BulkRequest
.
Builder
br
=
new
BulkRequest
.
Builder
();
...
...
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/RetransmissionService.java
View file @
b1c592cb
...
@@ -208,7 +208,7 @@ public class RetransmissionService {
...
@@ -208,7 +208,7 @@ public class RetransmissionService {
if
(
StringUtils
.
isNotEmpty
(
res
))
{
if
(
StringUtils
.
isNotEmpty
(
res
))
{
break
;
break
;
}
}
}
catch
(
Http
Exception
e
)
{
}
catch
(
Exception
e
)
{
addServerRequestCount
(
ocrServerAddress
.
getIp
(),
-
1
);
addServerRequestCount
(
ocrServerAddress
.
getIp
(),
-
1
);
retryCount
++;
retryCount
++;
log
.
error
(
"OCR云平台接口异常, 准备重试 fileId={}, serverIp={}, 当前重试次数={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
retryCount
,
e
);
log
.
error
(
"OCR云平台接口异常, 准备重试 fileId={}, serverIp={}, 当前重试次数={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
retryCount
,
e
);
...
@@ -319,7 +319,7 @@ public class RetransmissionService {
...
@@ -319,7 +319,7 @@ public class RetransmissionService {
if
(
StringUtils
.
isNotEmpty
(
res
))
{
if
(
StringUtils
.
isNotEmpty
(
res
))
{
break
;
break
;
}
}
}
catch
(
Http
Exception
e
)
{
}
catch
(
Exception
e
)
{
addServerRequestCount
(
ocrServerAddress
.
getIp
(),
-
1
);
addServerRequestCount
(
ocrServerAddress
.
getIp
(),
-
1
);
retryCount
++;
retryCount
++;
log
.
error
(
"OCR云平台接口异常, 准备重试 fileId={}, serverIp={}, 当前重试次数={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
retryCount
,
e
);
log
.
error
(
"OCR云平台接口异常, 准备重试 fileId={}, serverIp={}, 当前重试次数={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
retryCount
,
e
);
...
@@ -370,7 +370,7 @@ public class RetransmissionService {
...
@@ -370,7 +370,7 @@ public class RetransmissionService {
}
}
// 赋值body
// 赋值body
IoUtil
.
copy
(
httpResponse
.
bodyStream
(),
response
.
getOutputStream
());
IoUtil
.
copy
(
httpResponse
.
bodyStream
(),
response
.
getOutputStream
());
}
catch
(
IO
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"OCR云平台接口异常"
,
e
);
log
.
error
(
"OCR云平台接口异常"
,
e
);
returnError
(
response
,
500
,
"OCR云平台接口异常"
);
returnError
(
response
,
500
,
"OCR云平台接口异常"
);
}
}
...
@@ -389,9 +389,10 @@ public class RetransmissionService {
...
@@ -389,9 +389,10 @@ public class RetransmissionService {
if
(
appAbilityRecordAll
==
null
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getServerIp
())
if
(
appAbilityRecordAll
==
null
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getServerIp
())
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getDstUrl
())
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getDstUrl
())
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getPdf
()))
{
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getPdf
()))
{
log
.
error
(
"文件下载未命中ES,准备从数据库中查询 id={}"
,
id
);
TmpRecordByTrigger
tmpRecordByTrigger
=
tmpRecordByTriggerMapper
.
selectById
(
id
);
TmpRecordByTrigger
tmpRecordByTrigger
=
tmpRecordByTriggerMapper
.
selectById
(
id
);
if
(
tmpRecordByTrigger
==
null
)
{
if
(
tmpRecordByTrigger
==
null
)
{
log
.
error
(
"从查询不到ID为 {} 的文件数据"
,
id
);
log
.
error
(
"从
数据库
查询不到ID为 {} 的文件数据"
,
id
);
return
;
return
;
}
}
elasticSearchService
.
recordDataImport
(
CollUtil
.
newArrayList
(
tmpRecordByTrigger
));
elasticSearchService
.
recordDataImport
(
CollUtil
.
newArrayList
(
tmpRecordByTrigger
));
...
@@ -461,9 +462,10 @@ public class RetransmissionService {
...
@@ -461,9 +462,10 @@ public class RetransmissionService {
if
(
appAbilityRecordAll
==
null
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getServerIp
())
if
(
appAbilityRecordAll
==
null
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getServerIp
())
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getDstUrl
())
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getDstUrl
())
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getPdf
()))
{
||
StrUtil
.
isBlank
(
appAbilityRecordAll
.
getPdf
()))
{
log
.
error
(
"文件下载未命中ES,准备从数据库中查询 id={}"
,
id
);
TmpRecordByTrigger
tmpRecordByTrigger
=
tmpRecordByTriggerMapper
.
selectById
(
id
);
TmpRecordByTrigger
tmpRecordByTrigger
=
tmpRecordByTriggerMapper
.
selectById
(
id
);
if
(
tmpRecordByTrigger
==
null
)
{
if
(
tmpRecordByTrigger
==
null
)
{
log
.
error
(
"从数据库
中无法获取
ID为 {} 的文件数据"
,
id
);
log
.
error
(
"从数据库
查询不到
ID为 {} 的文件数据"
,
id
);
return
;
return
;
}
}
elasticSearchService
.
recordDataImport
(
CollUtil
.
newArrayList
(
tmpRecordByTrigger
));
elasticSearchService
.
recordDataImport
(
CollUtil
.
newArrayList
(
tmpRecordByTrigger
));
...
@@ -539,7 +541,7 @@ public class RetransmissionService {
...
@@ -539,7 +541,7 @@ public class RetransmissionService {
if
(
StringUtils
.
isNotEmpty
(
res
))
{
if
(
StringUtils
.
isNotEmpty
(
res
))
{
break
;
break
;
}
}
}
catch
(
Http
Exception
e
)
{
}
catch
(
Exception
e
)
{
addServerRequestCount
(
ocrServerAddress
.
getIp
(),
-
1
);
addServerRequestCount
(
ocrServerAddress
.
getIp
(),
-
1
);
retryCount
++;
retryCount
++;
log
.
error
(
"OCR云平台接口异常, 准备重试 fileId={}, serverIp={}, 当前重试次数={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
retryCount
,
e
);
log
.
error
(
"OCR云平台接口异常, 准备重试 fileId={}, serverIp={}, 当前重试次数={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
retryCount
,
e
);
...
@@ -555,7 +557,7 @@ public class RetransmissionService {
...
@@ -555,7 +557,7 @@ public class RetransmissionService {
saveToAppAbilityRecordAll
(
result
,
request
,
ocrServerAddress
.
getIp
(),
fileId
);
saveToAppAbilityRecordAll
(
result
,
request
,
ocrServerAddress
.
getIp
(),
fileId
);
return
result
;
return
result
;
}
catch
(
IO
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"OCR云平台接口异常, fileId={}, serverIp={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
e
);
log
.
error
(
"OCR云平台接口异常, fileId={}, serverIp={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
e
);
return
new
OcrResult
(
"007500"
,
"识别失败,请重试"
,
null
,
DateUtil
.
date
());
return
new
OcrResult
(
"007500"
,
"识别失败,请重试"
,
null
,
DateUtil
.
date
());
}
finally
{
}
finally
{
...
@@ -610,7 +612,7 @@ public class RetransmissionService {
...
@@ -610,7 +612,7 @@ public class RetransmissionService {
if
(
StringUtils
.
isNotEmpty
(
res
))
{
if
(
StringUtils
.
isNotEmpty
(
res
))
{
break
;
break
;
}
}
}
catch
(
Http
Exception
e
)
{
}
catch
(
Exception
e
)
{
addServerRequestCount
(
ocrServerAddress
.
getIp
(),
-
1
);
addServerRequestCount
(
ocrServerAddress
.
getIp
(),
-
1
);
retryCount
++;
retryCount
++;
log
.
error
(
"OCR云平台接口异常, 准备重试 fileId={}, serverIp={}, 当前重试次数={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
retryCount
);
log
.
error
(
"OCR云平台接口异常, 准备重试 fileId={}, serverIp={}, 当前重试次数={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
retryCount
);
...
@@ -626,7 +628,7 @@ public class RetransmissionService {
...
@@ -626,7 +628,7 @@ public class RetransmissionService {
saveToAppAbilityRecordAll
(
result
,
request
,
ocrServerAddress
.
getIp
(),
fileId
);
saveToAppAbilityRecordAll
(
result
,
request
,
ocrServerAddress
.
getIp
(),
fileId
);
return
result
;
return
result
;
}
catch
(
IO
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"OCR云平台接口异常, fileId={}, serverIp={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
e
);
log
.
error
(
"OCR云平台接口异常, fileId={}, serverIp={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
e
);
return
new
OcrResult
(
"007500"
,
"识别失败,请重试"
,
null
,
DateUtil
.
date
());
return
new
OcrResult
(
"007500"
,
"识别失败,请重试"
,
null
,
DateUtil
.
date
());
}
finally
{
}
finally
{
...
@@ -675,7 +677,7 @@ public class RetransmissionService {
...
@@ -675,7 +677,7 @@ public class RetransmissionService {
saveToAppAbilityRecordAll
(
result
,
request
,
ocrServerAddress
.
getIp
(),
fileId
);
saveToAppAbilityRecordAll
(
result
,
request
,
ocrServerAddress
.
getIp
(),
fileId
);
return
result
;
return
result
;
}
catch
(
IO
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"OCR云平台接口异常, fileId={}, serverIp={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
e
);
log
.
error
(
"OCR云平台接口异常, fileId={}, serverIp={}"
,
fileId
,
ocrServerAddress
.
getIp
(),
e
);
return
new
OcrResult
(
"007500"
,
"识别失败,请重试"
,
null
,
DateUtil
.
date
());
return
new
OcrResult
(
"007500"
,
"识别失败,请重试"
,
null
,
DateUtil
.
date
());
}
finally
{
}
finally
{
...
...
src/main/java/com/gxmailu/ocrCloudPlatform/vo/OcrResult.java
View file @
b1c592cb
...
@@ -13,7 +13,7 @@ public class OcrResult {
...
@@ -13,7 +13,7 @@ public class OcrResult {
private
String
code
;
private
String
code
;
private
String
message
;
private
String
message
;
private
Object
data
;
private
Object
data
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd'T'HH:mm:ss.SSS
SX
"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd'T'HH:mm:ss.SSS
'Z'
"
)
private
Date
time
;
private
Date
time
;
public
OcrResult
(
String
code
,
String
msg
,
Object
data
,
Date
time
)
{
public
OcrResult
(
String
code
,
String
msg
,
Object
data
,
Date
time
)
{
...
...
src/main/resources/application-dev.yml
View file @
b1c592cb
...
@@ -72,6 +72,6 @@ elasticsearch:
...
@@ -72,6 +72,6 @@ elasticsearch:
username
:
elastic
username
:
elastic
password
:
RQuT4eQIdIZ57waX9f87
password
:
RQuT4eQIdIZ57waX9f87
#eureka:
eureka
:
# client:
client
:
# enabled: false
enabled
:
false
\ No newline at end of file
\ No newline at end of file
src/test/java/com/gxmailu/ocrCloudPlatform/ESTest.java
View file @
b1c592cb
...
@@ -110,6 +110,41 @@ public class ESTest {
...
@@ -110,6 +110,41 @@ public class ESTest {
System
.
out
.
println
(
totalHits
.
value
());
System
.
out
.
println
(
totalHits
.
value
());
}
}
// @Test
public
static
void
main
(
String
[]
args
)
{
ArrayList
<
CallRecordModel
>
callRecordModels
=
new
ArrayList
<>();
Court
court1
=
new
Court
();
court1
.
setIpScope
(
"192.168.4."
);
court1
.
setName
(
"南宁市中级人民法院"
);
Court
court2
=
new
Court
();
court2
.
setIpScope
(
"192.168.2.;192.168.1."
);
court2
.
setName
(
"柳州市中级人民法院"
);
List
<
Court
>
courtList
=
new
ArrayList
<>();
courtList
.
add
(
court1
);
courtList
.
add
(
court2
);
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
CallRecordModel
callRecordModel
=
new
CallRecordModel
();
callRecordModel
.
setIp
(
"192.168.4."
+
i
);
callRecordModel
.
setCourtName
(
courtList
.
stream
()
.
filter
(
court
->
Arrays
.
stream
(
court
.
getIpScope
().
split
(
";"
)).
anyMatch
(
callRecordModel
.
getIp
()::
contains
))
.
findFirst
()
.
map
(
Court:
:
getName
)
.
orElse
(
"未知"
));
callRecordModels
.
add
(
callRecordModel
);
}
// CallRecordModel recordModel = new CallRecordModel();
// recordModel.setIp("192.168.1.1");
//
// recordModel.setCourtName(courtList.stream()
// .filter(court -> Arrays.stream(court.getIpScope().split(";")).anyMatch(recordModel.getIp()::contains))
// .findFirst()
// .map(Court::getName)
// .orElse("未知"));
System
.
out
.
println
(
callRecordModels
);
}
@Test
@Test
public
void
getCourtUseSum
()
throws
IOException
{
public
void
getCourtUseSum
()
throws
IOException
{
List
<
Court
>
courtList
;
List
<
Court
>
courtList
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment