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
143a56a0
Commit
143a56a0
authored
Jan 27, 2024
by
黄明步
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
完成应用能力调用记录导出,修复导出数据缺失bug
parent
b1c592cb
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
104 additions
and
40 deletions
+104
-40
src/main/java/com/gxmailu/ocrCloudPlatform/controller/AppAbilityRecordAllController.java
+66
-19
src/main/java/com/gxmailu/ocrCloudPlatform/dto/RecordDto.java
+2
-1
src/main/java/com/gxmailu/ocrCloudPlatform/excel/model/CallRecordModel.java
+4
-3
src/main/java/com/gxmailu/ocrCloudPlatform/service/AppAbilityRecordAllService.java
+3
-1
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/AppAbilityRecordAllServiceImpl.java
+5
-5
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/ElasticSearchService.java
+0
-0
src/main/java/com/gxmailu/ocrCloudPlatform/vo/AppAbilityRecordVo.java
+18
-4
src/test/java/com/gxmailu/ocrCloudPlatform/ESTest.java
+6
-7
No files found.
src/main/java/com/gxmailu/ocrCloudPlatform/controller/AppAbilityRecordAllController.java
View file @
143a56a0
...
@@ -8,12 +8,14 @@ import com.alibaba.excel.util.MapUtils;
...
@@ -8,12 +8,14 @@ import com.alibaba.excel.util.MapUtils;
import
com.alibaba.excel.write.style.HorizontalCellStyleStrategy
;
import
com.alibaba.excel.write.style.HorizontalCellStyleStrategy
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.gxmailu.ocrCloudPlatform.dto.RecordDto
;
import
com.gxmailu.ocrCloudPlatform.dto.RecordDto
;
import
com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecordAll
;
import
com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecordAll
;
import
com.gxmailu.ocrCloudPlatform.excel.handler.ExcelFillCellMergeStrategy
;
import
com.gxmailu.ocrCloudPlatform.excel.handler.ExcelFillCellMergeStrategy
;
import
com.gxmailu.ocrCloudPlatform.excel.model.CallRecordModel
;
import
com.gxmailu.ocrCloudPlatform.excel.model.CallRecordModel
;
import
com.gxmailu.ocrCloudPlatform.excel.utils.ExcelStyleUtils
;
import
com.gxmailu.ocrCloudPlatform.excel.utils.ExcelStyleUtils
;
import
com.gxmailu.ocrCloudPlatform.service.AppAbilityRecordAllService
;
import
com.gxmailu.ocrCloudPlatform.service.AppAbilityRecordAllService
;
import
com.gxmailu.ocrCloudPlatform.vo.AppAbilityRecordVo
;
import
com.gxmailu.ocrCloudPlatform.vo.Result
;
import
com.gxmailu.ocrCloudPlatform.vo.Result
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
...
@@ -22,7 +24,9 @@ import org.springframework.util.Assert;
...
@@ -22,7 +24,9 @@ import org.springframework.util.Assert;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.ws.rs.GET
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.net.URLEncoder
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -45,14 +49,14 @@ public class AppAbilityRecordAllController {
...
@@ -45,14 +49,14 @@ public class AppAbilityRecordAllController {
/**
/**
* 导出应用调用记录
* 导出应用调用记录
*
*
* @param yearMonthDay 年月日
calendar
* @param yearMonthDay 年月日
*/
*/
@RequestMapping
(
"/deriveCallRecord"
)
@RequestMapping
(
"/deriveCallRecord"
)
@ResponseBody
@ResponseBody
public
void
deriveCallRecord
(
String
yearMonthDay
,
String
endYearMonthDay
,
HttpServletResponse
response
)
{
public
void
deriveCallRecord
(
String
yearMonthDay
,
String
endYearMonthDay
,
HttpServletResponse
response
)
{
//设置到新的对象上,用以下面的文件名称处理
//
设置到新的对象上,用以下面的文件名称处理
String
newYearMonthDay
=
yearMonthDay
;
String
newYearMonthDay
=
yearMonthDay
;
if
(
StrUtil
.
isNotBlank
(
yearMonthDay
))
{
if
(
StrUtil
.
isNotBlank
(
yearMonthDay
))
{
int
count
=
yearMonthDay
.
split
(
"-"
).
length
;
int
count
=
yearMonthDay
.
split
(
"-"
).
length
;
switch
(
count
)
{
switch
(
count
)
{
case
1
:
case
1
:
...
@@ -73,23 +77,24 @@ public class AppAbilityRecordAllController {
...
@@ -73,23 +77,24 @@ public class AppAbilityRecordAllController {
break
;
break
;
}
}
System
.
out
.
println
(
"yearMonthDay=========="
+
yearMonthDay
+
";endYearMonthDay=========="
+
endYearMonthDay
);
}
else
{
}
else
{
yearMonthDay
=
DateUtil
.
parse
(
"2014-01-01 00:00:00"
,
"yyyy-MM-dd HH:mm:ss"
).
toString
();
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
();
endYearMonthDay
=
DateUtil
.
parse
(
DateUtil
.
date
().
toString
(),
"yyyy-MM-dd HH:mm:ss"
).
toString
();
}
}
try
{
System
.
out
.
println
(
"yearMonthDay=========="
+
yearMonthDay
+
";endYearMonthDay=========="
+
endYearMonthDay
);
try
{
List
<
CallRecordModel
>
callRecordList
=
this
.
recordAllService
.
selectCallRecord
(
yearMonthDay
,
endYearMonthDay
);
List
<
CallRecordModel
>
callRecordList
=
this
.
recordAllService
.
selectCallRecord
(
yearMonthDay
,
endYearMonthDay
);
Assert
.
notNull
(
callRecordList
,
"未找到相关数据"
);
Assert
.
notNull
(
callRecordList
,
"未找到相关数据"
);
String
fileName
=
StringUtils
.
isEmpty
(
newYearMonthDay
)
?
"各法院调用统计.xlsx"
:
"各法院"
+
newYearMonthDay
+
"调用统计.xlsx"
;
String
fileName
=
StringUtils
.
isEmpty
(
newYearMonthDay
)
?
"各法院调用统计.xlsx"
:
"各法院"
+
newYearMonthDay
+
"调用统计.xlsx"
;
fileName
=
URLEncoder
.
encode
(
fileName
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
);
// 设置单元格样式策略
// 设置单元格样式策略
HorizontalCellStyleStrategy
horizontalCellStyleStrategy
=
new
HorizontalCellStyleStrategy
(
ExcelStyleUtils
.
getHeadStyle
(),
ExcelStyleUtils
.
getContentStyle
());
HorizontalCellStyleStrategy
horizontalCellStyleStrategy
=
new
HorizontalCellStyleStrategy
(
ExcelStyleUtils
.
getHeadStyle
(),
ExcelStyleUtils
.
getContentStyle
());
EasyExcel
.
write
(
response
.
getOutputStream
(),
CallRecordModel
.
class
)
EasyExcel
.
write
(
response
.
getOutputStream
(),
CallRecordModel
.
class
)
.
sheet
(
"导出数据"
)
.
sheet
(
StrUtil
.
isBlank
(
newYearMonthDay
)
?
"ALL"
:
newYearMonthDay
)
.
head
(
CallRecordModel
.
class
)
.
head
(
CallRecordModel
.
class
)
// 自动行宽策略
// 自动行宽策略
.
registerWriteHandler
(
new
LongestMatchColumnWidthStyleStrategy
())
.
registerWriteHandler
(
new
LongestMatchColumnWidthStyleStrategy
())
...
@@ -98,7 +103,7 @@ public class AppAbilityRecordAllController {
...
@@ -98,7 +103,7 @@ public class AppAbilityRecordAllController {
// 设置单元格样式
// 设置单元格样式
.
registerWriteHandler
(
horizontalCellStyleStrategy
)
.
registerWriteHandler
(
horizontalCellStyleStrategy
)
.
doWrite
(
callRecordList
);
.
doWrite
(
callRecordList
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
)
{
log
.
error
(
"导出异常"
,
e
);
log
.
error
(
"导出异常"
,
e
);
// 重置response
// 重置response
response
.
reset
();
response
.
reset
();
...
@@ -106,7 +111,7 @@ public class AppAbilityRecordAllController {
...
@@ -106,7 +111,7 @@ public class AppAbilityRecordAllController {
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setCharacterEncoding
(
"utf-8"
);
Map
<
String
,
String
>
map
=
MapUtils
.
newHashMap
();
Map
<
String
,
String
>
map
=
MapUtils
.
newHashMap
();
map
.
put
(
"status"
,
"500"
);
map
.
put
(
"status"
,
"500"
);
map
.
put
(
"message"
,
"
数据过大,导出文件失败
"
);
map
.
put
(
"message"
,
"
由于导出数据量过大,导致无法导出。请移步详见后台管理-应用能力调用记录
"
);
try
{
try
{
response
.
getWriter
().
println
(
JSON
.
toJSONString
(
map
));
response
.
getWriter
().
println
(
JSON
.
toJSONString
(
map
));
}
catch
(
IOException
ex
)
{
}
catch
(
IOException
ex
)
{
...
@@ -128,20 +133,62 @@ public class AppAbilityRecordAllController {
...
@@ -128,20 +133,62 @@ public class AppAbilityRecordAllController {
return
recordAllService
.
getList
(
recordDto
);
return
recordAllService
.
getList
(
recordDto
);
}
}
@PostMapping
(
"/exportRecord"
)
public
Object
exportRecord
(
RecordDto
recordDto
,
HttpServletResponse
response
)
{
Assert
.
notNull
(
recordDto
,
"参数不能为空"
);
try
{
if
(
StrUtil
.
isNotBlank
(
recordDto
.
getIpScope
()))
{
recordDto
.
setIpScopeList
(
StrUtil
.
splitTrim
(
recordDto
.
getIpScope
(),
";"
));
}
Page
<
AppAbilityRecordVo
>
recordListByPage
=
recordAllService
.
getRecordListByPage
(
recordDto
);
String
fileName
=
URLEncoder
.
encode
(
"fileName"
,
"UTF-8"
).
replaceAll
(
"\\+"
,
"%20"
);
response
.
setContentType
(
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
);
response
.
setCharacterEncoding
(
"utf-8"
);
response
.
setHeader
(
"Content-disposition"
,
"attachment;filename*=utf-8''"
+
fileName
);
// 设置单元格样式策略
HorizontalCellStyleStrategy
horizontalCellStyleStrategy
=
new
HorizontalCellStyleStrategy
(
ExcelStyleUtils
.
getHeadStyle
(),
ExcelStyleUtils
.
getContentStyle
());
EasyExcel
.
write
(
response
.
getOutputStream
(),
AppAbilityRecordVo
.
class
)
.
sheet
(
"调用记录"
)
.
head
(
AppAbilityRecordVo
.
class
)
// 自动行宽策略
.
registerWriteHandler
(
new
LongestMatchColumnWidthStyleStrategy
())
// 自定义合并策略
.
registerWriteHandler
(
new
ExcelFillCellMergeStrategy
(
0
,
0
,
new
int
[]{
0
,
1
}))
// 设置单元格样式
.
registerWriteHandler
(
horizontalCellStyleStrategy
)
.
doWrite
(
recordListByPage
.
getRecords
());
}
catch
(
IOException
e
)
{
log
.
error
(
"调用记录导出异常"
,
e
);
response
.
reset
();
response
.
setContentType
(
"application/json"
);
response
.
setCharacterEncoding
(
"utf-8"
);
Map
<
String
,
String
>
map
=
MapUtils
.
newHashMap
();
map
.
put
(
"status"
,
"500"
);
map
.
put
(
"message"
,
"由于导出数据量过大,处理失败。"
);
try
{
response
.
getWriter
().
println
(
JSON
.
toJSONString
(
map
));
}
catch
(
IOException
ex
)
{
log
.
error
(
""
,
ex
);
}
}
return
null
;
}
@PostMapping
(
"/getListByPage"
)
@PostMapping
(
"/getListByPage"
)
public
Result
getListByPage
(
@RequestBody
RecordDto
recordDto
)
{
public
Result
getListByPage
(
@RequestBody
RecordDto
recordDto
)
{
Assert
.
notNull
(
recordDto
,
"参数不能为空"
);
Assert
.
notNull
(
recordDto
,
"参数不能为空"
);
try
{
try
{
return
Result
.
success
(
""
,
recordAllService
.
getRecordList
(
recordDto
));
return
Result
.
success
(
""
,
recordAllService
.
getRecordList
ByPage
(
recordDto
));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
error
(
"调用记录查询异常"
,
e
);
log
.
error
(
"调用记录查询异常"
,
e
);
return
Result
.
error
(
"查询异常,请联系管理员"
);
return
Result
.
error
(
"查询异常,请联系管理员"
);
}
}
}
}
@PostMapping
(
"/getById"
)
@PostMapping
(
"/getById"
)
public
Object
getById
(
Long
id
)
{
public
Object
getById
(
Long
id
)
{
Assert
.
notNull
(
id
,
"参数不能为空"
);
Assert
.
notNull
(
id
,
"参数不能为空"
);
return
Result
.
success
(
""
,
recordAllService
.
getById
(
id
));
return
Result
.
success
(
""
,
recordAllService
.
getById
(
id
));
}
}
...
@@ -151,27 +198,27 @@ public class AppAbilityRecordAllController {
...
@@ -151,27 +198,27 @@ public class AppAbilityRecordAllController {
}
}
@GetMapping
(
"/getCourtUseInYear"
)
@GetMapping
(
"/getCourtUseInYear"
)
public
Object
getCourtUseInYear
(
@RequestParam
Integer
year
,
@RequestParam
String
courtName
)
{
public
Object
getCourtUseInYear
(
@RequestParam
Integer
year
,
@RequestParam
String
courtName
)
{
return
recordAllService
.
getCourtUseInYear
(
year
,
courtName
);
return
recordAllService
.
getCourtUseInYear
(
year
,
courtName
);
}
}
@GetMapping
(
"/getCourtUseInMonth"
)
@GetMapping
(
"/getCourtUseInMonth"
)
public
Object
getCourtUseInMonth
(
Integer
year
,
Integer
month
,
String
courtName
)
{
public
Object
getCourtUseInMonth
(
Integer
year
,
Integer
month
,
String
courtName
)
{
return
recordAllService
.
getCourtUseInMonth
(
year
,
month
,
courtName
);
return
recordAllService
.
getCourtUseInMonth
(
year
,
month
,
courtName
);
}
}
@GetMapping
(
"/getCourtUseInDay"
)
@GetMapping
(
"/getCourtUseInDay"
)
public
Object
getCourtUseInDay
(
Integer
year
,
Integer
month
,
Integer
day
,
String
courtName
)
{
public
Object
getCourtUseInDay
(
Integer
year
,
Integer
month
,
Integer
day
,
String
courtName
)
{
return
recordAllService
.
getCourtUseInDay
(
year
,
month
,
day
,
courtName
);
return
recordAllService
.
getCourtUseInDay
(
year
,
month
,
day
,
courtName
);
}
}
@GetMapping
(
"getCorrelationData"
)
@GetMapping
(
"getCorrelationData"
)
public
Result
getCorrelationDate
(
String
day1
,
String
day2
)
{
public
Result
getCorrelationDate
(
String
day1
,
String
day2
)
{
return
recordAllService
.
getCorrelationData
(
day1
,
day2
);
return
recordAllService
.
getCorrelationData
(
day1
,
day2
);
}
}
@GetMapping
(
"getBrokenLineData"
)
@GetMapping
(
"getBrokenLineData"
)
public
Result
getBrokenLineData
(
String
date
){
public
Result
getBrokenLineData
(
String
date
)
{
return
recordAllService
.
getBrokenLineData
(
date
);
return
recordAllService
.
getBrokenLineData
(
date
);
}
}
...
...
src/main/java/com/gxmailu/ocrCloudPlatform/dto/RecordDto.java
View file @
143a56a0
...
@@ -15,7 +15,7 @@ public class RecordDto implements Serializable {
...
@@ -15,7 +15,7 @@ public class RecordDto implements Serializable {
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
private
Integer
court
Id
;
private
Integer
court
Code
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
startTime
;
private
Date
startTime
;
...
@@ -25,6 +25,7 @@ public class RecordDto implements Serializable {
...
@@ -25,6 +25,7 @@ public class RecordDto implements Serializable {
private
Date
endTime
;
private
Date
endTime
;
private
String
applicationId
;
private
String
applicationId
;
private
String
abilityId
;
private
String
abilityId
;
private
String
ipScope
;
private
List
<
String
>
ipScopeList
;
private
List
<
String
>
ipScopeList
;
private
Integer
page
;
private
Integer
page
;
private
Integer
limit
;
private
Integer
limit
;
...
...
src/main/java/com/gxmailu/ocrCloudPlatform/excel/model/CallRecordModel.java
View file @
143a56a0
...
@@ -2,6 +2,7 @@ package com.gxmailu.ocrCloudPlatform.excel.model;
...
@@ -2,6 +2,7 @@ package com.gxmailu.ocrCloudPlatform.excel.model;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -29,7 +30,7 @@ public class CallRecordModel implements Serializable {
...
@@ -29,7 +30,7 @@ public class CallRecordModel implements Serializable {
@ExcelIgnore
@ExcelIgnore
@ExcelProperty
(
value
=
"总调用次数"
)
@ExcelProperty
(
value
=
"总调用次数"
)
private
Integer
callCount
;
private
Long
callCount
;
@ExcelIgnore
@ExcelIgnore
@ExcelProperty
(
value
=
"用户调用次数"
)
@ExcelProperty
(
value
=
"用户调用次数"
)
...
@@ -42,7 +43,7 @@ public class CallRecordModel implements Serializable {
...
@@ -42,7 +43,7 @@ public class CallRecordModel implements Serializable {
@ExcelProperty
(
value
=
"识别能力"
,
index
=
2
)
@ExcelProperty
(
value
=
"识别能力"
,
index
=
2
)
private
String
abilityName
;
private
String
abilityName
;
@ExcelProperty
(
value
=
"调用次数"
,
index
=
3
)
@ExcelProperty
(
value
=
"调用次数"
,
index
=
3
)
private
l
ong
abilityDocCount
;
private
L
ong
abilityDocCount
;
@ExcelProperty
(
value
=
"总识别页数"
,
index
=
4
)
@ExcelProperty
(
value
=
"总识别页数"
,
index
=
4
)
private
Integer
fileCount
;
private
Long
fileCount
;
}
}
src/main/java/com/gxmailu/ocrCloudPlatform/service/AppAbilityRecordAllService.java
View file @
143a56a0
package
com
.
gxmailu
.
ocrCloudPlatform
.
service
;
package
com
.
gxmailu
.
ocrCloudPlatform
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.gxmailu.ocrCloudPlatform.dto.RecordDto
;
import
com.gxmailu.ocrCloudPlatform.dto.RecordDto
;
import
com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecordAll
;
import
com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecordAll
;
import
com.gxmailu.ocrCloudPlatform.entity.DeriveCallRecord
;
import
com.gxmailu.ocrCloudPlatform.entity.DeriveCallRecord
;
import
com.gxmailu.ocrCloudPlatform.excel.model.CallRecordModel
;
import
com.gxmailu.ocrCloudPlatform.excel.model.CallRecordModel
;
import
com.gxmailu.ocrCloudPlatform.vo.AppAbilityRecordVo
;
import
com.gxmailu.ocrCloudPlatform.vo.Result
;
import
com.gxmailu.ocrCloudPlatform.vo.Result
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -39,5 +41,5 @@ public interface AppAbilityRecordAllService extends IService<AppAbilityRecordAll
...
@@ -39,5 +41,5 @@ public interface AppAbilityRecordAllService extends IService<AppAbilityRecordAll
Result
getBrokenLineData
(
String
date
);
Result
getBrokenLineData
(
String
date
);
Object
getRecordList
(
RecordDto
recordDto
)
throws
IOException
;
Page
<
AppAbilityRecordVo
>
getRecordListByPage
(
RecordDto
recordDto
)
throws
IOException
;
}
}
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/AppAbilityRecordAllServiceImpl.java
View file @
143a56a0
...
@@ -102,10 +102,10 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
...
@@ -102,10 +102,10 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
@Override
@Override
public
Object
getList
(
RecordDto
recordDto
)
{
public
Object
getList
(
RecordDto
recordDto
)
{
List
<
String
>
serverIpList
=
new
ArrayList
<>();
List
<
String
>
serverIpList
=
new
ArrayList
<>();
Integer
court
Id
=
recordDto
.
getCourtId
();
Integer
court
Code
=
recordDto
.
getCourtCode
();
Integer
network
=
recordDto
.
getNetwork
();
Integer
network
=
recordDto
.
getNetwork
();
List
<
ServerInfo
>
list
=
serverInfoMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
ServerInfo
.
class
)
List
<
ServerInfo
>
list
=
serverInfoMapper
.
selectList
(
Wrappers
.
lambdaQuery
(
ServerInfo
.
class
)
.
eq
(
court
Id
!=
null
,
ServerInfo:
:
getCourtCode
,
courtId
)
.
eq
(
court
Code
!=
null
,
ServerInfo:
:
getCourtCode
,
courtCode
)
.
eq
(
network
!=
null
&&
network
!=
-
1
,
ServerInfo:
:
getNetwork
,
network
));
.
eq
(
network
!=
null
&&
network
!=
-
1
,
ServerInfo:
:
getNetwork
,
network
));
for
(
ServerInfo
serverInfo
:
list
)
{
for
(
ServerInfo
serverInfo
:
list
)
{
serverIpList
.
add
(
serverInfo
.
getIp
());
serverIpList
.
add
(
serverInfo
.
getIp
());
...
@@ -129,7 +129,7 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
...
@@ -129,7 +129,7 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
}
}
@Override
@Override
public
Page
<
AppAbilityRecordVo
>
getRecordList
(
RecordDto
recordDto
)
throws
IOException
{
public
Page
<
AppAbilityRecordVo
>
getRecordList
ByPage
(
RecordDto
recordDto
)
throws
IOException
{
// 获取应用用户配置
// 获取应用用户配置
List
<
ConfigAbility
>
configAbilityList
=
configAbilityService
.
selectAll
();
List
<
ConfigAbility
>
configAbilityList
=
configAbilityService
.
selectAll
();
Map
<
String
,
ConfigAbility
>
abilityMap
=
configAbilityList
.
stream
().
collect
(
Collectors
.
toMap
(
ConfigAbility:
:
getId
,
obj
->
obj
));
Map
<
String
,
ConfigAbility
>
abilityMap
=
configAbilityList
.
stream
().
collect
(
Collectors
.
toMap
(
ConfigAbility:
:
getId
,
obj
->
obj
));
...
@@ -146,7 +146,7 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
...
@@ -146,7 +146,7 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
redisService
.
set
(
RedisConstant
.
COURT_LIST
,
courtList
,
1L
,
TimeUnit
.
DAYS
);
redisService
.
set
(
RedisConstant
.
COURT_LIST
,
courtList
,
1L
,
TimeUnit
.
DAYS
);
}
}
Page
<
AppAbilityRecord
>
recordByPage
=
elasticSearchService
.
getRecordList
(
recordDto
);
Page
<
AppAbilityRecord
>
recordByPage
=
elasticSearchService
.
getRecordList
ByPage
(
recordDto
);
ArrayList
<
AppAbilityRecordVo
>
recordVoList
=
new
ArrayList
<>();
ArrayList
<
AppAbilityRecordVo
>
recordVoList
=
new
ArrayList
<>();
recordByPage
.
getRecords
().
forEach
(
abilityRecord
->
{
recordByPage
.
getRecords
().
forEach
(
abilityRecord
->
{
...
@@ -155,7 +155,7 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
...
@@ -155,7 +155,7 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
recordVo
.
setIp
(
abilityRecord
.
getIp
().
split
(
","
)[
0
]);
recordVo
.
setIp
(
abilityRecord
.
getIp
().
split
(
","
)[
0
]);
Optional
<
Court
>
first
=
courtList
.
stream
().
filter
(
court
->
{
Optional
<
Court
>
first
=
courtList
.
stream
().
filter
(
court
->
{
String
ipScope
=
court
.
getIpScope
();
String
ipScope
=
court
.
getIpScope
();
String
[]
ipScopes
=
ipScope
.
split
(
";"
);
List
<
String
>
ipScopes
=
StrUtil
.
splitTrim
(
ipScope
,
";"
);
for
(
String
scope
:
ipScopes
)
{
for
(
String
scope
:
ipScopes
)
{
if
(
recordVo
.
getIp
().
startsWith
(
scope
))
{
if
(
recordVo
.
getIp
().
startsWith
(
scope
))
{
return
true
;
return
true
;
...
...
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/ElasticSearchService.java
View file @
143a56a0
This diff is collapsed.
Click to expand it.
src/main/java/com/gxmailu/ocrCloudPlatform/vo/AppAbilityRecordVo.java
View file @
143a56a0
package
com
.
gxmailu
.
ocrCloudPlatform
.
vo
;
package
com
.
gxmailu
.
ocrCloudPlatform
.
vo
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -12,37 +13,50 @@ import java.util.Date;
...
@@ -12,37 +13,50 @@ import java.util.Date;
@Data
@Data
public
class
AppAbilityRecordVo
{
public
class
AppAbilityRecordVo
{
@ExcelProperty
(
value
=
"编号"
,
index
=
0
)
private
String
id
;
private
String
id
;
/**
/**
* 法院名称
* 法院名称
*/
*/
@ExcelProperty
(
value
=
"法院名称"
,
index
=
1
)
private
String
courtName
;
private
String
courtName
;
/**
/**
* 业务厂家
* 业务厂家
*/
*/
@ExcelProperty
(
value
=
"业务厂家"
,
index
=
2
)
private
String
businessVendors
;
private
String
businessVendors
;
private
String
appAbilityName
;
private
String
ip
;
/**
/**
*
文件页数
*
识别能力
*/
*/
private
Integer
fileCount
;
@ExcelProperty
(
value
=
"识别能力"
,
index
=
3
)
private
String
appAbilityName
;
@ExcelProperty
(
value
=
"调用方IP"
,
index
=
4
)
private
String
ip
;
/**
/**
* 调用次数
* 调用次数
*/
*/
@ExcelProperty
(
value
=
"调用次数"
,
index
=
5
)
private
String
callCount
;
private
String
callCount
;
/**
/**
* 文件页数
*/
@ExcelProperty
(
value
=
"文件页数"
,
index
=
6
)
private
Integer
fileCount
;
/**
* 调用时间
* 调用时间
*/
*/
@ExcelProperty
(
value
=
"调用时间"
,
index
=
7
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
callTime
;
private
Date
callTime
;
/**
/**
* 调用服务器ip
* 调用服务器ip
*/
*/
@ExcelProperty
(
value
=
"服务器ip"
,
index
=
8
)
private
String
serverIp
;
private
String
serverIp
;
}
}
src/test/java/com/gxmailu/ocrCloudPlatform/ESTest.java
View file @
143a56a0
...
@@ -97,7 +97,7 @@ public class ESTest {
...
@@ -97,7 +97,7 @@ public class ESTest {
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
.
field
(
"callTime"
)
.
field
(
"callTime"
)
.
gte
(
JsonData
.
of
(
start
.
toString
()))
.
gte
(
JsonData
.
of
(
start
.
toString
()))
.
lt
(
JsonData
.
of
(
end
.
toString
()))));
.
lt
e
(
JsonData
.
of
(
end
.
toString
()))));
if
(
ObjUtil
.
isNotNull
(
court
)
&&
StrUtil
.
isNotBlank
(
court
.
getIpScope
()))
{
if
(
ObjUtil
.
isNotNull
(
court
)
&&
StrUtil
.
isNotBlank
(
court
.
getIpScope
()))
{
boolQuery
.
must
(
mustQuery
->
mustQuery
.
prefix
(
pq
->
pq
.
field
(
"ip"
).
value
(
court
.
getIpScope
())));
boolQuery
.
must
(
mustQuery
->
mustQuery
.
prefix
(
pq
->
pq
.
field
(
"ip"
).
value
(
court
.
getIpScope
())));
}
}
...
@@ -210,7 +210,7 @@ public class ESTest {
...
@@ -210,7 +210,7 @@ public class ESTest {
// recordDto.setApplicationId(5L);
// recordDto.setApplicationId(5L);
// recordDto.setStartTime(DateUtil.parseDate("2023-05-11"));
// recordDto.setStartTime(DateUtil.parseDate("2023-05-11"));
// recordDto.setEndTime(DateUtil.parseDate("2023-05-11"));
// recordDto.setEndTime(DateUtil.parseDate("2023-05-11"));
Page
<
AppAbilityRecord
>
recordList
=
elasticSearchService
.
getRecordList
(
recordDto
);
Page
<
AppAbilityRecord
>
recordList
=
elasticSearchService
.
getRecordList
ByPage
(
recordDto
);
recordList
.
getRecords
().
forEach
(
System
.
out
::
println
);
recordList
.
getRecords
().
forEach
(
System
.
out
::
println
);
// Object recordList1 = appAbilityRecordAllService.getRecordList(recordDto);
// Object recordList1 = appAbilityRecordAllService.getRecordList(recordDto);
...
@@ -284,7 +284,6 @@ public class ESTest {
...
@@ -284,7 +284,6 @@ public class ESTest {
List
<
BrokenLineData
>
brokenLineData
=
null
;
List
<
BrokenLineData
>
brokenLineData
=
null
;
// 创建一个公共方法获取数据
String
finalDate
=
date
;
String
finalDate
=
date
;
Supplier
<
List
<
BrokenLineData
>>
fetchData
=
()
->
{
Supplier
<
List
<
BrokenLineData
>>
fetchData
=
()
->
{
List
<
BrokenLineData
>
data
=
recordAllMapper
.
selectBrokenLineData
(
finalDate
);
List
<
BrokenLineData
>
data
=
recordAllMapper
.
selectBrokenLineData
(
finalDate
);
...
@@ -293,7 +292,7 @@ public class ESTest {
...
@@ -293,7 +292,7 @@ public class ESTest {
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
.
field
(
"callTime"
)
.
field
(
"callTime"
)
.
gte
(
JsonData
.
of
(
DateUtil
.
beginOfDay
(
nowDateTime
).
toString
()))
.
gte
(
JsonData
.
of
(
DateUtil
.
beginOfDay
(
nowDateTime
).
toString
()))
.
lt
(
JsonData
.
of
(
DateUtil
.
endOfDay
(
nowDateTime
).
toString
()))));
.
lt
e
(
JsonData
.
of
(
DateUtil
.
endOfDay
(
nowDateTime
).
toString
()))));
return
boolQuery
;
return
boolQuery
;
})).
aggregations
(
"count"
,
agg
->
agg
.
dateHistogram
(
DateHistogramAggregation
.
of
(
s
->
s
.
field
(
"callTime"
)
})).
aggregations
(
"count"
,
agg
->
agg
.
dateHistogram
(
DateHistogramAggregation
.
of
(
s
->
s
.
field
(
"callTime"
)
.
calendarInterval
(
CalendarInterval
.
Minute
)))).
trackTotalHits
(
tb
->
tb
.
enabled
(
true
)),
Void
.
class
);
.
calendarInterval
(
CalendarInterval
.
Minute
)))).
trackTotalHits
(
tb
->
tb
.
enabled
(
true
)),
Void
.
class
);
...
@@ -333,7 +332,7 @@ public class ESTest {
...
@@ -333,7 +332,7 @@ public class ESTest {
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
.
field
(
"callTime"
)
.
field
(
"callTime"
)
.
gte
(
JsonData
.
of
(
DateUtil
.
beginOfDay
(
nowDateTime
).
toString
()))
.
gte
(
JsonData
.
of
(
DateUtil
.
beginOfDay
(
nowDateTime
).
toString
()))
.
lt
(
JsonData
.
of
(
DateUtil
.
endOfDay
(
nowDateTime
).
toString
()))));
.
lt
e
(
JsonData
.
of
(
DateUtil
.
endOfDay
(
nowDateTime
).
toString
()))));
return
boolQuery
;
return
boolQuery
;
})).
aggregations
(
"record"
,
agg
->
agg
.
dateHistogram
(
DateHistogramAggregation
.
of
(
s
->
s
.
field
(
"callTime"
)
})).
aggregations
(
"record"
,
agg
->
agg
.
dateHistogram
(
DateHistogramAggregation
.
of
(
s
->
s
.
field
(
"callTime"
)
.
calendarInterval
(
CalendarInterval
.
Minute
)))).
trackTotalHits
(
tb
->
tb
.
enabled
(
true
)),
Void
.
class
);
.
calendarInterval
(
CalendarInterval
.
Minute
)))).
trackTotalHits
(
tb
->
tb
.
enabled
(
true
)),
Void
.
class
);
...
@@ -369,7 +368,7 @@ public class ESTest {
...
@@ -369,7 +368,7 @@ public class ESTest {
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
boolQuery
.
must
(
q
->
q
.
range
(
rangeQueryBuilder
->
rangeQueryBuilder
.
field
(
"callTime"
)
.
field
(
"callTime"
)
.
gte
(
JsonData
.
of
(
start
))
.
gte
(
JsonData
.
of
(
start
))
.
lt
(
JsonData
.
of
(
end
))));
.
lt
e
(
JsonData
.
of
(
end
))));
return
boolQuery
;
return
boolQuery
;
}))
}))
.
size
(
0
)
.
size
(
0
)
...
@@ -389,7 +388,7 @@ public class ESTest {
...
@@ -389,7 +388,7 @@ public class ESTest {
searchResponse
.
aggregations
().
get
(
"ip_agg"
).
sterms
().
buckets
().
array
().
forEach
(
ipBucket
->
{
searchResponse
.
aggregations
().
get
(
"ip_agg"
).
sterms
().
buckets
().
array
().
forEach
(
ipBucket
->
{
ipBucket
.
aggregations
().
get
(
"applicationId_agg"
).
lterms
().
buckets
().
array
().
forEach
(
applicationIdBucket
->
{
ipBucket
.
aggregations
().
get
(
"applicationId_agg"
).
lterms
().
buckets
().
array
().
forEach
(
applicationIdBucket
->
{
applicationIdBucket
.
aggregations
().
get
(
"ablilityId_agg"
).
lterms
().
buckets
().
array
().
forEach
(
abilityIdBucket
->
{
applicationIdBucket
.
aggregations
().
get
(
"ablilityId_agg"
).
lterms
().
buckets
().
array
().
forEach
(
abilityIdBucket
->
{
int
fileCount
=
(
int
)
abilityIdBucket
.
aggregations
().
get
(
"fileCount"
).
sum
().
value
();
long
fileCount
=
(
long
)
abilityIdBucket
.
aggregations
().
get
(
"fileCount"
).
sum
().
value
();
CallRecordModel
recordModel
=
new
CallRecordModel
();
CallRecordModel
recordModel
=
new
CallRecordModel
();
recordModel
.
setIp
(
ipBucket
.
key
().
stringValue
());
recordModel
.
setIp
(
ipBucket
.
key
().
stringValue
());
...
...
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