Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
李苗
/
Vion-DevOps
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 1d3f1149
authored
Nov 08, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[add]
1.添加异常 mall 列表接口 2.字段补充
1 parent
2b9ddb87
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
6 deletions
src/main/java/vion/controller/monitor/MallController.java
src/main/java/vion/model/monitor/EventRecord.java
src/main/java/vion/service/impl/monitor/MallServiceImpl.java
src/main/java/vion/service/monitor/IMallService.java
src/main/java/vion/vo/monitor/MallVO.java
src/main/java/vion/controller/monitor/MallController.java
View file @
1d3f114
...
...
@@ -45,6 +45,12 @@ public class MallController {
return
mallService
.
listAttention
(
dto
);
}
@GetMapping
(
"/errorAttention"
)
@SaCheckPermission
(
value
=
"mall:attention:listError"
,
orRole
=
"admin"
)
public
Page
<
MallVO
>
listErrorAttention
(
MallDTO
dto
)
{
return
mallService
.
listErrorAttention
(
dto
);
}
@PostMapping
(
"/attention"
)
@SaCheckPermission
(
value
=
"mall:attention:edit"
,
orRole
=
"admin"
)
public
String
attention
(
@RequestBody
List
<
MallDTO
>
dtoList
)
{
...
...
src/main/java/vion/model/monitor/EventRecord.java
View file @
1d3f114
...
...
@@ -24,6 +24,12 @@ public class EventRecord {
private
String
agentUid
;
/**
* agent类型 1:store,2:mall
*/
@TableField
(
value
=
"agent_type"
)
private
Short
agentType
;
/**
* 所属集团uid
*/
@TableField
(
value
=
"account_uid"
)
...
...
src/main/java/vion/service/impl/monitor/MallServiceImpl.java
View file @
1d3f114
...
...
@@ -9,6 +9,7 @@ import lombok.RequiredArgsConstructor;
import
lombok.extern.slf4j.Slf4j
;
import
net.dreamlu.iot.mqtt.codec.MqttQoS
;
import
net.dreamlu.iot.mqtt.spring.client.MqttClientTemplate
;
import
org.dromara.hutool.core.collection.CollUtil
;
import
org.dromara.hutool.core.lang.Assert
;
import
org.dromara.hutool.core.lang.Opt
;
import
org.dromara.hutool.core.text.StrUtil
;
...
...
@@ -16,10 +17,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
vion.dto.monitor.MallDTO
;
import
vion.mapper.monitor.MallMapper
;
import
vion.model.monitor.EventRecord
;
import
vion.model.monitor.MAccount
;
import
vion.model.monitor.Mall
;
import
vion.model.monitor.RAgentEvent
;
import
vion.model.monitor.*
;
import
vion.service.monitor.IEventRecordService
;
import
vion.service.monitor.IMAccountService
;
import
vion.service.monitor.IMallService
;
...
...
@@ -78,9 +76,11 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
var
wrapper
=
new
MPJLambdaWrapper
<>(
converter
.
convert
(
dto
,
Mall
.
class
))
.
selectAll
(
Mall
.
class
)
.
selectAs
(
MAccount:
:
getName
,
MallVO:
:
getAccountName
)
.
selectAs
(
Agent:
:
getHostname
,
MallVO:
:
getHostname
)
.
leftJoin
(
MAccount
.
class
,
MAccount:
:
getUid
,
Mall:
:
getAccountUid
)
.
leftJoin
(
Agent
.
class
,
Agent:
:
getUid
,
Mall:
:
getAgentUid
)
.
eq
(
Mall:
:
getAttention
,
1
)
.
orderByDesc
(
Mall:
:
getUpdateTime
);
.
orderByDesc
(
Mall:
:
getU
id
,
Mall:
:
getU
pdateTime
);
var
mallVOPage
=
this
.
selectJoinListPage
(
Page
.
of
(
dto
.
getPageNum
(),
dto
.
getPageSize
()),
MallVO
.
class
,
wrapper
);
Opt
.
ofEmptyAble
(
mallVOPage
.
getRecords
())
.
ifPresent
(
r
->
{
...
...
@@ -91,8 +91,44 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
.
in
(
"mall_uid"
,
mallUidList
)
.
orderByDesc
(
"mall_uid"
,
"create_time"
);
var
eventRecordList
=
eventRecordService
.
list
(
eventRecWrapper
);
var
mallUid2SelfMap
=
eventRecordList
.
stream
().
collect
(
Collectors
.
groupingBy
(
EventRecord:
:
getMallUid
));
var
mallUid2RecMap
=
eventRecordList
.
stream
().
collect
(
Collectors
.
groupingBy
(
EventRecord:
:
getMallUid
));
var
agentEventList
=
agentEventService
.
lambdaQuery
().
in
(
RAgentEvent:
:
getMallUid
,
mallUidList
).
list
();
var
mallUid2AgentEventMap
=
agentEventList
.
stream
().
collect
(
Collectors
.
groupingBy
(
RAgentEvent:
:
getMallUid
));
r
.
forEach
(
tmp
->
{
tmp
.
setEventRecordList
(
mallUid2RecMap
.
getOrDefault
(
tmp
.
getUid
(),
List
.
of
()));
tmp
.
setAgentEventList
(
mallUid2AgentEventMap
.
getOrDefault
(
tmp
.
getUid
(),
List
.
of
()));
});
});
return
mallVOPage
;
}
@Override
public
Page
<
MallVO
>
listErrorAttention
(
MallDTO
dto
)
{
var
eventRecWrapper
=
Wrappers
.<
EventRecord
>
query
()
.
select
(
"DISTINCT on (mall_uid) *"
)
.
eq
(
"agent_type"
,
dto
.
getAgentType
())
.
ne
(
"status"
,
1
)
.
orderByDesc
(
"mall_uid"
,
"create_time"
);
var
eventRecordList
=
eventRecordService
.
list
(
eventRecWrapper
);
if
(
CollUtil
.
isEmpty
(
eventRecordList
))
{
return
null
;
}
var
mallUidList
=
eventRecordList
.
stream
().
map
(
EventRecord:
:
getMallUid
).
toList
();
var
wrapper
=
new
MPJLambdaWrapper
<>(
converter
.
convert
(
dto
,
Mall
.
class
))
.
selectAll
(
Mall
.
class
)
.
selectAs
(
MAccount:
:
getName
,
MallVO:
:
getAccountName
)
.
selectAs
(
Agent:
:
getHostname
,
MallVO:
:
getHostname
)
.
leftJoin
(
MAccount
.
class
,
MAccount:
:
getUid
,
Mall:
:
getAccountUid
)
.
leftJoin
(
Agent
.
class
,
Agent:
:
getUid
,
Mall:
:
getAgentUid
)
.
in
(
Mall:
:
getUid
,
mallUidList
)
.
orderByDesc
(
Mall:
:
getUid
,
Mall:
:
getUpdateTime
);
var
mallVOPage
=
this
.
selectJoinListPage
(
Page
.
of
(
dto
.
getPageNum
(),
dto
.
getPageSize
()),
MallVO
.
class
,
wrapper
);
Opt
.
ofEmptyAble
(
mallVOPage
.
getRecords
())
.
ifPresent
(
r
->
{
var
mallUid2SelfMap
=
eventRecordList
.
stream
().
collect
(
Collectors
.
groupingBy
(
EventRecord:
:
getMallUid
));
r
.
forEach
(
tmp
->
tmp
.
setEventRecordList
(
mallUid2SelfMap
.
get
(
tmp
.
getUid
())));
});
return
mallVOPage
;
...
...
src/main/java/vion/service/monitor/IMallService.java
View file @
1d3f114
...
...
@@ -23,6 +23,8 @@ public interface IMallService extends MPJBaseService<Mall> {
Page
<
MallVO
>
listAttention
(
MallDTO
dto
);
Page
<
MallVO
>
listErrorAttention
(
MallDTO
dto
);
String
attention
(
List
<
MallDTO
>
dtoList
);
String
attentionByAccount
(
String
accountUid
);
...
...
src/main/java/vion/vo/monitor/MallVO.java
View file @
1d3f114
...
...
@@ -3,6 +3,7 @@ package vion.vo.monitor;
import
lombok.Getter
;
import
lombok.Setter
;
import
vion.model.monitor.EventRecord
;
import
vion.model.monitor.RAgentEvent
;
import
java.time.LocalDateTime
;
import
java.util.List
;
...
...
@@ -76,4 +77,10 @@ public class MallVO {
private
LocalDateTime
updateTime
;
private
List
<
EventRecord
>
eventRecordList
;
private
List
<
RAgentEvent
>
agentEventList
;
/**
* 主机名
*/
private
String
hostname
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment