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
6cec22f8
Commit
6cec22f8
authored
Apr 26, 2024
by
黄明步
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增oa用户识别记录
parent
77135644
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
271 additions
and
24 deletions
+271
-24
src/main/java/com/gxmailu/ocrCloudPlatform/controller/AppAbilityRecordAllController.java
+40
-2
src/main/java/com/gxmailu/ocrCloudPlatform/controller/StatController.java
+0
-17
src/main/java/com/gxmailu/ocrCloudPlatform/dto/RecordDto.java
+10
-0
src/main/java/com/gxmailu/ocrCloudPlatform/entity/OaCallRecord.java
+107
-0
src/main/java/com/gxmailu/ocrCloudPlatform/mapper/OaCallRecordMapper.java
+18
-0
src/main/java/com/gxmailu/ocrCloudPlatform/service/AppAbilityRecordAllService.java
+1
-1
src/main/java/com/gxmailu/ocrCloudPlatform/service/OaCallRecordService.java
+19
-0
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/AppAbilityRecordAllServiceImpl.java
+12
-0
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/ElasticSearchService.java
+17
-0
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/OaCallRecordServiceImpl.java
+38
-0
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/StatService.java
+8
-3
src/main/java/com/gxmailu/ocrCloudPlatform/utils/PrometheusHttpUtil.java
+1
-1
No files found.
src/main/java/com/gxmailu/ocrCloudPlatform/controller/AppAbilityRecordAllController.java
View file @
6cec22f8
...
...
@@ -11,12 +11,16 @@ import com.alibaba.fastjson.JSON;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.gxmailu.ocrCloudPlatform.dto.RecordDto
;
import
com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecordAll
;
import
com.gxmailu.ocrCloudPlatform.entity.OaCallRecord
;
import
com.gxmailu.ocrCloudPlatform.excel.handler.ExcelFillCellMergeStrategy
;
import
com.gxmailu.ocrCloudPlatform.excel.model.CallRecordModel
;
import
com.gxmailu.ocrCloudPlatform.excel.utils.ExcelStyleUtils
;
import
com.gxmailu.ocrCloudPlatform.service.AppAbilityRecordAllService
;
import
com.gxmailu.ocrCloudPlatform.service.OaCallRecordService
;
import
com.gxmailu.ocrCloudPlatform.vo.AppAbilityRecordVo
;
import
com.gxmailu.ocrCloudPlatform.vo.Result
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -37,6 +41,7 @@ import java.util.Map;
* @author zyz
* @since 2023-05-11
*/
@Api
(
tags
=
"应用调用记录相关接口"
)
@Slf4j
@RestController
@RequestMapping
(
"/appAbilityRecordAll"
)
...
...
@@ -45,13 +50,16 @@ public class AppAbilityRecordAllController {
@Autowired
private
AppAbilityRecordAllService
recordAllService
;
@Autowired
private
OaCallRecordService
oaCallRecordService
;
/**
* 导出应用调用记录
*
* @param yearMonthDay 年月日
*/
@
Reques
tMapping
(
"/deriveCallRecord"
)
@
ResponseBody
@
Ge
tMapping
(
"/deriveCallRecord"
)
@
ApiOperation
(
value
=
"导出调用记录"
)
public
void
deriveCallRecord
(
String
yearMonthDay
,
String
endYearMonthDay
,
HttpServletResponse
response
)
{
// 设置到新的对象上,用以下面的文件名称处理
String
newYearMonthDay
=
yearMonthDay
;
...
...
@@ -173,6 +181,7 @@ public class AppAbilityRecordAllController {
}
@PostMapping
(
"/getListByPage"
)
@ApiOperation
(
value
=
"获取应用调用记录"
)
public
Result
getListByPage
(
@RequestBody
RecordDto
recordDto
)
{
Assert
.
notNull
(
recordDto
,
"参数不能为空"
);
try
{
...
...
@@ -191,33 +200,62 @@ public class AppAbilityRecordAllController {
@GetMapping
(
"/getCourtUseSum"
)
@ApiOperation
(
value
=
"获取法院总使用量"
)
public
Object
getCourtUseSum
()
{
return
recordAllService
.
getCourtUseSum
();
}
@GetMapping
(
"/getCourtUseInYear"
)
@ApiOperation
(
value
=
"获取法院年度使用量"
)
public
Object
getCourtUseInYear
(
@RequestParam
Integer
year
,
@RequestParam
String
courtName
)
{
return
recordAllService
.
getCourtUseInYear
(
year
,
courtName
);
}
@GetMapping
(
"/getCourtUseInMonth"
)
@ApiOperation
(
value
=
"获取法院月使用量"
)
public
Object
getCourtUseInMonth
(
Integer
year
,
Integer
month
,
String
courtName
)
{
return
recordAllService
.
getCourtUseInMonth
(
year
,
month
,
courtName
);
}
@GetMapping
(
"/getCourtUseInDay"
)
@ApiOperation
(
value
=
"获取法院日使用量"
)
public
Object
getCourtUseInDay
(
Integer
year
,
Integer
month
,
Integer
day
,
String
courtName
)
{
return
recordAllService
.
getCourtUseInDay
(
year
,
month
,
day
,
courtName
);
}
@GetMapping
(
"getCorrelationData"
)
@ApiOperation
(
value
=
"获取今日昨日对比折线图"
)
public
Result
getCorrelationDate
(
String
day1
,
String
day2
)
{
return
recordAllService
.
getCorrelationData
(
day1
,
day2
);
}
@GetMapping
(
"getBrokenLineData"
)
@ApiOperation
(
value
=
"获取指定日期折线图"
)
public
Result
getBrokenLineData
(
String
date
)
{
return
recordAllService
.
getBrokenLineData
(
date
);
}
@PostMapping
(
"/saveOaOcrRecord"
)
@ApiOperation
(
value
=
"保存Oa门户用户的调用OCR记录"
)
public
Result
saveOaOcrRecord
(
@RequestBody
OaCallRecord
oaCallRecord
)
{
try
{
List
<
AppAbilityRecordAll
>
recordList
=
recordAllService
.
getRecordByFileId
(
oaCallRecord
.
getFileIds
());
int
sum
=
recordList
.
stream
().
mapToInt
(
AppAbilityRecordAll:
:
getFileCount
).
sum
();
oaCallRecord
.
setPages
(
sum
);
oaCallRecord
.
setCreateTime
(
DateUtil
.
date
());
oaCallRecordService
.
save
(
oaCallRecord
);
return
Result
.
success
(
"成功"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"saveOaOcrRecord执行失败"
,
e
);
}
return
Result
.
error
(
"保存OA用户调用记录失败"
);
}
@GetMapping
(
"/getOaCallRecords"
)
@ApiOperation
(
value
=
"查询Oa门户用户的调用OCR记录"
)
public
Result
getOaCallRecordList
(
RecordDto
dto
)
{
return
Result
.
success
(
"查询成功"
,
oaCallRecordService
.
getOaCallRecordList
(
dto
));
}
}
src/main/java/com/gxmailu/ocrCloudPlatform/controller/StatController.java
View file @
6cec22f8
...
...
@@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.annotation.Resource
;
import
java.util.*
;
/**
* 统计相关
...
...
@@ -54,20 +53,4 @@ public class StatController {
public
Result
getServerMonitoring
(
@RequestParam
(
value
=
"time"
,
required
=
false
)
Long
time
)
{
return
statService
.
getServerMonitoring
(
time
);
}
public
static
void
main
(
String
[]
args
)
{
List
<
List
<
String
>>
listOfLists
=
new
ArrayList
<>();
listOfLists
.
add
(
Arrays
.
asList
(
"b"
,
"2"
,
"3"
));
listOfLists
.
add
(
Arrays
.
asList
(
"a"
,
"4"
,
"5"
));
listOfLists
.
add
(
Arrays
.
asList
(
"d"
,
"6"
,
"7"
));
listOfLists
.
add
(
Arrays
.
asList
(
"c"
,
"8"
,
"9"
));
System
.
out
.
println
(
"原始二维列表:"
+
listOfLists
);
// 对二维列表中的元素进行排序
Collections
.
sort
(
listOfLists
,
Comparator
.
comparing
(
list
->
list
.
get
(
0
)));
System
.
out
.
println
(
"按第一个元素排序后的二维列表:"
+
listOfLists
);
}
}
src/main/java/com/gxmailu/ocrCloudPlatform/dto/RecordDto.java
View file @
6cec22f8
...
...
@@ -34,4 +34,14 @@ public class RecordDto implements Serializable {
*/
private
Integer
network
;
/**
* 门户用户昵称
*/
private
String
nickName
;
/**
* 部门名称
*/
private
String
deptName
;
}
src/main/java/com/gxmailu/ocrCloudPlatform/entity/OaCallRecord.java
0 → 100644
View file @
6cec22f8
/*
* Copyright 2019-2020 Zheng Jie
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
com
.
gxmailu
.
ocrCloudPlatform
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
* 在线用户
*
* @author wilmiam
* @since 2021-07-09 18:13
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName
(
"oa_call_record"
)
public
class
OaCallRecord
implements
Serializable
{
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 用户ID
*/
private
Long
userId
;
/**
* 用户名
*/
private
String
userName
;
/**
* 昵称
*/
private
String
nickName
;
/**
* 部门ID
*/
private
Long
deptId
;
/**
* 部门名称
*/
private
String
deptName
;
/**
* 浏览器
*/
private
String
browser
;
/**
* IP
*/
private
String
ip
;
/**
* 地址
*/
private
String
address
;
/**
* 登录时间
*/
private
Date
loginTime
;
/**
* 文件id列表
*/
@TableField
(
exist
=
false
)
@JsonIgnore
private
List
<
String
>
fileIds
;
/**
* 识别页数
*/
private
Integer
pages
;
private
Date
createTime
;
private
Date
updateTime
;
}
src/main/java/com/gxmailu/ocrCloudPlatform/mapper/OaCallRecordMapper.java
0 → 100644
View file @
6cec22f8
package
com
.
gxmailu
.
ocrCloudPlatform
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.gxmailu.ocrCloudPlatform.entity.OaCallRecord
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* <p>
* Oa门户用户ocr识别记录
* </p>
*
* @author Hmb
* @since 2024-04-19
*/
@Mapper
public
interface
OaCallRecordMapper
extends
BaseMapper
<
OaCallRecord
>
{
}
src/main/java/com/gxmailu/ocrCloudPlatform/service/AppAbilityRecordAllService.java
View file @
6cec22f8
...
...
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.gxmailu.ocrCloudPlatform.dto.RecordDto
;
import
com.gxmailu.ocrCloudPlatform.entity.AppAbilityRecordAll
;
import
com.gxmailu.ocrCloudPlatform.entity.DeriveCallRecord
;
import
com.gxmailu.ocrCloudPlatform.excel.model.CallRecordModel
;
import
com.gxmailu.ocrCloudPlatform.vo.AppAbilityRecordVo
;
import
com.gxmailu.ocrCloudPlatform.vo.Result
;
...
...
@@ -42,4 +41,5 @@ public interface AppAbilityRecordAllService extends IService<AppAbilityRecordAll
Result
getBrokenLineData
(
String
date
);
Page
<
AppAbilityRecordVo
>
getRecordListByPage
(
RecordDto
recordDto
)
throws
IOException
;
List
<
AppAbilityRecordAll
>
getRecordByFileId
(
List
<
String
>
fileIds
)
throws
Exception
;
}
src/main/java/com/gxmailu/ocrCloudPlatform/service/OaCallRecordService.java
0 → 100644
View file @
6cec22f8
package
com
.
gxmailu
.
ocrCloudPlatform
.
service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.gxmailu.ocrCloudPlatform.dto.RecordDto
;
import
com.gxmailu.ocrCloudPlatform.entity.OaCallRecord
;
/**
* <p>
* OaOCR调用记录 服务类
* </p>
*
* @author Hmb
* @since 2024-04-12
*/
public
interface
OaCallRecordService
extends
IService
<
OaCallRecord
>
{
Page
<
OaCallRecord
>
getOaCallRecordList
(
RecordDto
dto
);
}
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/AppAbilityRecordAllServiceImpl.java
View file @
6cec22f8
...
...
@@ -182,6 +182,18 @@ public class AppAbilityRecordAllServiceImpl extends ServiceImpl<AppAbilityRecord
}
@Override
public
List
<
AppAbilityRecordAll
>
getRecordByFileId
(
List
<
String
>
fileIds
)
throws
Exception
{
List
<
AppAbilityRecordAll
>
list
=
new
ArrayList
<>();
for
(
String
fileId
:
fileIds
)
{
AppAbilityRecordAll
record
=
elasticSearchService
.
getRecordByFileId
(
fileId
);
if
(
record
!=
null
)
{
list
.
add
(
record
);
}
}
return
list
;
}
@Override
public
Object
getCourtUseSum
()
{
List
<
Court
>
courtList
=
courtService
.
getCourtList
();
return
elasticSearchService
.
getCourtUseSum
(
courtList
);
...
...
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/ElasticSearchService.java
View file @
6cec22f8
...
...
@@ -544,4 +544,21 @@ public class ElasticSearchService {
// 将 Map 中的值转回列表
return
new
ArrayList
<>(
mergedMap
.
values
());
}
public
AppAbilityRecordAll
getRecordByFileId
(
String
fileId
)
throws
Exception
{
SearchResponse
<
AppAbilityRecordAll
>
response
=
client
.
search
(
s
->
s
.
index
(
APP_ABILITY_RECORD_INDEX
)
.
size
(
1
)
.
query
(
q
->
q
.
bool
(
boolQuery
->
{
if
(
StrUtil
.
isNotBlank
(
fileId
))
{
boolQuery
.
must
(
builder
->
builder
.
term
(
t
->
t
.
field
(
"fileId"
).
value
(
fileId
)));
}
return
boolQuery
;
})),
AppAbilityRecordAll
.
class
);
return
CollUtil
.
isEmpty
(
response
.
hits
().
hits
())
?
null
:
response
.
hits
().
hits
().
get
(
0
).
source
();
}
}
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/OaCallRecordServiceImpl.java
0 → 100644
View file @
6cec22f8
package
com
.
gxmailu
.
ocrCloudPlatform
.
service
.
impl
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.gxmailu.ocrCloudPlatform.dto.RecordDto
;
import
com.gxmailu.ocrCloudPlatform.entity.OaCallRecord
;
import
com.gxmailu.ocrCloudPlatform.mapper.OaCallRecordMapper
;
import
com.gxmailu.ocrCloudPlatform.service.OaCallRecordService
;
import
org.springframework.stereotype.Service
;
/**
* <p>
* OaOCR调用记录 服务实现类
* </p>
*
* @author zyz
* @since 2024-04-12
*/
@Service
public
class
OaCallRecordServiceImpl
extends
ServiceImpl
<
OaCallRecordMapper
,
OaCallRecord
>
implements
OaCallRecordService
{
@Override
public
Page
<
OaCallRecord
>
getOaCallRecordList
(
RecordDto
dto
)
{
LambdaQueryWrapper
<
OaCallRecord
>
wrapper
=
Wrappers
.
lambdaQuery
(
OaCallRecord
.
class
);
if
(
StrUtil
.
isNotBlank
(
dto
.
getNickName
()))
{
wrapper
.
like
(
OaCallRecord:
:
getNickName
,
dto
.
getNickName
());
}
if
(
StrUtil
.
isNotBlank
(
dto
.
getDeptName
()))
{
wrapper
.
like
(
OaCallRecord:
:
getDeptName
,
dto
.
getDeptName
());
}
Page
<
OaCallRecord
>
page
=
new
Page
<>(
dto
.
getPage
(),
dto
.
getLimit
());
return
baseMapper
.
selectPage
(
page
,
wrapper
);
}
}
src/main/java/com/gxmailu/ocrCloudPlatform/service/impl/StatService.java
View file @
6cec22f8
...
...
@@ -34,6 +34,7 @@ import javax.annotation.Resource;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.CopyOnWriteArrayList
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -305,7 +306,7 @@ public class StatService {
.
eq
(
ServerInfo:
:
getNetwork
,
"0"
)
.
select
(
ServerInfo:
:
getIp
,
ServerInfo:
:
getName
));
List
<
List
<
String
>>
metricList
=
new
ArrayList
<>();
List
<
List
<
String
>>
metricList
=
new
CopyOnWrite
ArrayList
<>();
List
<
CompletableFuture
<
Void
>>
futures
=
new
ArrayList
<>();
...
...
@@ -378,7 +379,11 @@ public class StatService {
}
CompletableFuture
.
allOf
(
futures
.
toArray
(
new
CompletableFuture
[
0
])).
join
();
// 等待所有查询完成
// 根据每个一维数组的第一个元素进行排序
metricList
.
sort
(
Comparator
.
comparing
(
list
->
list
.
get
(
0
)));
metricList
.
sort
(
Comparator
.
comparing
(
list
->
list
!=
null
&&
!
list
.
isEmpty
()
?
list
.
get
(
0
)
:
null
,
Comparator
.
nullsLast
(
Comparator
.
naturalOrder
())
));
List
<
String
>
metricName
=
new
ArrayList
<>(
Arrays
.
asList
(
"metric"
,
"硬盘"
,
"CPU"
,
"内存"
,
"GPU"
,
"近5分钟平均系统负载"
));
// 添加到第一个元素
...
...
@@ -391,7 +396,7 @@ public class StatService {
log
.
error
(
"查询服务器资源信息发生异常:"
,
e
);
Object
value
=
redisService
.
getValue
(
RedisConstant
.
SERVER_MONITORING
);
List
<
Object
>
list
=
JSONUtil
.
toList
(
value
.
toString
(),
Object
.
class
);
return
Result
.
error
(
"查询资源信息失败
"
,
list
);
return
Result
.
success
(
"成功
"
,
list
);
}
}
}
src/main/java/com/gxmailu/ocrCloudPlatform/utils/PrometheusHttpUtil.java
View file @
6cec22f8
...
...
@@ -48,7 +48,7 @@ public class PrometheusHttpUtil {
public
static
PromDataInfo
getQueryDataInfo
(
String
promQL
,
Long
time
)
{
time
=
null
!=
time
?
time
:
System
.
currentTimeMillis
()
/
1000
;
log
.
info
(
"请求地址:{},请求PromQL:{},时间戳:{}"
,
QUERY_URL
,
promQL
,
time
);
//
log.info("请求地址:{},请求PromQL:{},时间戳:{}", QUERY_URL, promQL, time);
JSONObject
param
=
new
JSONObject
();
param
.
put
(
PromConstants
.
QUERY
,
promQL
);
param
.
put
(
"time"
,
time
);
...
...
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