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 a0ef9ded
authored
Nov 22, 2024
by
HlQ
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[add]
1.添加文件类型32 2.新增创建人、更新人配置 3.mall 列表添加备注字段
1 parent
073b354e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
51 additions
and
24 deletions
src/main/java/vion/config/mp/MyBatisPlusConfig.java
src/main/java/vion/controller/FileController.java
src/main/java/vion/controller/monitor/MallController.java
src/main/java/vion/model/FileInfo.java
src/main/java/vion/model/monitor/RMallRemark.java
src/main/java/vion/service/impl/monitor/MallServiceImpl.java
src/main/java/vion/vo/monitor/MallVO.java
src/main/java/vion/config/mp/MyBatisPlusConfig.java
View file @
a0ef9de
package
vion
.
config
.
mp
;
import
cn.dev33.satoken.stp.StpUtil
;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
...
...
@@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerIntercept
import
org.apache.ibatis.reflection.MetaObject
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
vion.vo.UserVO
;
import
java.time.LocalDateTime
;
...
...
@@ -22,12 +24,23 @@ public class MyBatisPlusConfig implements MetaObjectHandler {
this
.
fillHasGetter
(
metaObject
,
"createTime"
,
LocalDateTime
.
now
());
this
.
fillHasGetter
(
metaObject
,
"modifyTime"
,
LocalDateTime
.
now
());
this
.
fillHasGetter
(
metaObject
,
"updateTime"
,
LocalDateTime
.
now
());
try
{
// 获取当前登录用户,并填充
var
vo
=
(
UserVO
)
StpUtil
.
getTokenSession
().
get
(
"curLoginUser"
);
this
.
fillHasGetter
(
metaObject
,
"creator"
,
vo
.
getUserid
());
}
catch
(
Exception
ignored
)
{
}
}
@Override
public
void
updateFill
(
MetaObject
metaObject
)
{
this
.
fillHasGetter
(
metaObject
,
"modifyTime"
,
LocalDateTime
.
now
());
this
.
fillHasGetter
(
metaObject
,
"updateTime"
,
LocalDateTime
.
now
());
try
{
var
vo
=
(
UserVO
)
StpUtil
.
getTokenSession
().
get
(
"curLoginUser"
);
this
.
fillHasGetter
(
metaObject
,
"updater"
,
vo
.
getUserid
());
}
catch
(
Exception
ignored
)
{
}
}
protected
void
fillHasGetter
(
MetaObject
metaObject
,
String
fieldName
,
Object
fieldVal
)
{
...
...
src/main/java/vion/controller/FileController.java
View file @
a0ef9de
...
...
@@ -128,13 +128,14 @@ public class FileController {
}
private
String
getPath
(
FileInfoDTO
dto
,
String
filename
)
{
String
path
;
if
(
"storeLog"
.
equals
(
dto
.
getFlag
()))
{
path
=
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"form"
+
FileUtil
.
FILE_SEPARATOR
+
"storeLog"
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getStoreId
()
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getSourceId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
}
else
{
path
=
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"form"
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getStoreId
()
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getSourceId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
}
return
path
;
return
switch
(
dto
.
getFlag
())
{
case
"storeLog"
->
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"form"
+
FileUtil
.
FILE_SEPARATOR
+
"storeLog"
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getStoreId
()
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getSourceId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
case
"monitor"
->
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"form"
+
FileUtil
.
FILE_SEPARATOR
+
"monitor"
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getSourceId
()
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getSourceId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
default
->
fileUrl
+
FileUtil
.
FILE_SEPARATOR
+
"form"
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getStoreId
()
+
FileUtil
.
FILE_SEPARATOR
+
dto
.
getSourceId
()
+
FileUtil
.
FILE_SEPARATOR
+
filename
;
};
}
@PostMapping
(
"/file/uploadFile"
)
...
...
src/main/java/vion/controller/monitor/MallController.java
View file @
a0ef9de
...
...
@@ -83,7 +83,7 @@ public class MallController {
@SaCheckPermission
(
value
=
"mall:remark:list"
,
orRole
=
"admin"
)
public
Page
<
RMallRemark
>
listRemark
(
RMallRemark
dto
)
{
return
mallRemarkService
.
lambdaQuery
(
dto
)
.
orderByDesc
(
RMallRemark:
:
getCreateTime
)
.
orderByDesc
(
RMallRemark:
:
get
RemarkDate
,
RMallRemark:
:
get
CreateTime
)
.
page
(
Page
.
of
(
dto
.
getPageNum
(),
dto
.
getPageSize
()));
}
...
...
src/main/java/vion/model/FileInfo.java
View file @
a0ef9de
...
...
@@ -40,6 +40,7 @@ public class FileInfo {
* <br>21服务单等表单富文本编辑器里传图用这个类型</br>
* <br>22备件,23返修</br>
* <br>24验收报告,25竣工图纸,26点位表,27项目总结,28前期勘察,29巡检报告,30结算资料,31启动会</br>
* <br>32运维监测项目监控里富文本编辑器传图用这个类型</br>
*/
private
Integer
sourceType
;
/**
...
...
src/main/java/vion/model/monitor/RMallRemark.java
View file @
a0ef9de
package
vion
.
model
.
monitor
;
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.baomidou.mybatisplus.annotation.*
;
import
lombok.Getter
;
import
lombok.Setter
;
import
vion.dto.BaseDTO
;
import
java.time.LocalDate
;
import
java.
util.Dat
e
;
import
java.
time.LocalDateTim
e
;
/**
* mall注释关联表
...
...
@@ -36,15 +33,15 @@ public class RMallRemark extends BaseDTO {
@TableField
(
value
=
"remark"
)
private
String
remark
;
@TableField
(
value
=
"creator"
)
@TableField
(
value
=
"creator"
,
fill
=
FieldFill
.
INSERT
)
private
String
creator
;
@TableField
(
value
=
"updater"
)
@TableField
(
value
=
"updater"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
String
updater
;
@TableField
(
value
=
"create_time"
)
private
Dat
e
createTime
;
@TableField
(
value
=
"create_time"
,
fill
=
FieldFill
.
INSERT
)
private
LocalDateTim
e
createTime
;
@TableField
(
value
=
"update_time"
)
private
Dat
e
updateTime
;
@TableField
(
value
=
"update_time"
,
fill
=
FieldFill
.
INSERT_UPDATE
)
private
LocalDateTim
e
updateTime
;
}
\ No newline at end of file
src/main/java/vion/service/impl/monitor/MallServiceImpl.java
View file @
a0ef9de
...
...
@@ -18,15 +18,14 @@ import org.springframework.transaction.annotation.Transactional;
import
vion.dto.monitor.MallDTO
;
import
vion.mapper.monitor.MallMapper
;
import
vion.model.monitor.*
;
import
vion.service.monitor.IEventRecordService
;
import
vion.service.monitor.IMAccountService
;
import
vion.service.monitor.IMallService
;
import
vion.service.monitor.IRAgentEventService
;
import
vion.service.monitor.*
;
import
vion.utils.JsonUtil
;
import
vion.utils.TopicUtil
;
import
vion.vo.monitor.MallVO
;
import
java.util.Comparator
;
import
java.util.List
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -41,6 +40,7 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
private
final
IMAccountService
accountService
;
private
final
IEventRecordService
eventRecordService
;
private
final
IRAgentEventService
agentEventService
;
private
final
IRMallRemarkService
mallRemarkService
;
private
final
MqttClientTemplate
client
;
private
final
Converter
converter
;
...
...
@@ -104,12 +104,16 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
var
eventRecordList
=
eventRecordService
.
list
(
eventRecWrapper
);
var
mallUid2RecMap
=
eventRecordList
.
stream
().
collect
(
Collectors
.
groupingBy
(
EventRecord:
:
getMallUid
));
var
remarkList
=
mallRemarkService
.
lambdaQuery
().
in
(
RMallRemark:
:
getMallUid
,
mallUidList
).
list
();
var
mallUid2RemarkMap
=
remarkList
.
stream
().
sorted
(
Comparator
.
comparing
(
RMallRemark:
:
getRemarkDate
).
reversed
().
thenComparing
(
Comparator
.
comparing
(
RMallRemark:
:
getCreateTime
).
reversed
())).
collect
(
Collectors
.
toMap
(
RMallRemark:
:
getMallUid
,
Function
.
identity
(),
(
r1
,
r2
)
->
r1
));
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
()));
tmp
.
setMallRemark
(
mallUid2RemarkMap
.
get
(
tmp
.
getUid
()));
});
});
return
mallVOPage
;
...
...
@@ -146,12 +150,16 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
var
eventRecordList
=
eventRecordService
.
list
(
eventRecWrapper
);
var
mallUid2RecMap
=
eventRecordList
.
stream
().
collect
(
Collectors
.
groupingBy
(
EventRecord:
:
getMallUid
));
var
remarkList
=
mallRemarkService
.
lambdaQuery
().
in
(
RMallRemark:
:
getMallUid
,
mallUidList
).
list
();
var
mallUid2RemarkMap
=
remarkList
.
stream
().
sorted
(
Comparator
.
comparing
(
RMallRemark:
:
getRemarkDate
).
reversed
().
thenComparing
(
Comparator
.
comparing
(
RMallRemark:
:
getCreateTime
).
reversed
())).
collect
(
Collectors
.
toMap
(
RMallRemark:
:
getMallUid
,
Function
.
identity
(),
(
r1
,
r2
)
->
r1
));
var
tmpAgentEventList
=
agentEventService
.
lambdaQuery
().
in
(
RAgentEvent:
:
getMallUid
,
mallUidList
).
list
();
var
mallUid2AgentEventMap
=
tmpAgentEventList
.
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
()));
tmp
.
setMallRemark
(
mallUid2RemarkMap
.
get
(
tmp
.
getUid
()));
});
});
return
mallVOPage
;
...
...
@@ -192,10 +200,14 @@ public class MallServiceImpl extends MPJBaseServiceImpl<MallMapper, Mall> implem
.
orderByDesc
(
"mall_uid"
,
"event_type"
,
"create_time"
);
var
tmpEventRecordList
=
eventRecordService
.
list
(
tmpWrapper
);
var
tmpMallUid2RecMap
=
tmpEventRecordList
.
stream
().
collect
(
Collectors
.
groupingBy
(
EventRecord:
:
getMallUid
));
r
.
forEach
(
tmp
->
{
var
remarkList
=
mallRemarkService
.
lambdaQuery
().
in
(
RMallRemark:
:
getMallUid
,
mallUidList
).
list
();
var
mallUid2RemarkMap
=
remarkList
.
stream
().
sorted
(
Comparator
.
comparing
(
RMallRemark:
:
getRemarkDate
).
reversed
().
thenComparing
(
Comparator
.
comparing
(
RMallRemark:
:
getCreateTime
).
reversed
())).
collect
(
Collectors
.
toMap
(
RMallRemark:
:
getMallUid
,
Function
.
identity
(),
(
r1
,
r2
)
->
r1
));
r
.
forEach
(
tmp
->
{
tmp
.
setEventRecordList
(
tmpMallUid2RecMap
.
getOrDefault
(
tmp
.
getUid
(),
List
.
of
()));
tmp
.
setAgentEventList
(
mallUid2AgentEventMap
.
getOrDefault
(
tmp
.
getUid
(),
List
.
of
()));
tmp
.
setMallRemark
(
mallUid2RemarkMap
.
get
(
tmp
.
getUid
()));
});
});
return
mallVOPage
;
...
...
src/main/java/vion/vo/monitor/MallVO.java
View file @
a0ef9de
...
...
@@ -4,6 +4,7 @@ import lombok.Getter;
import
lombok.Setter
;
import
vion.model.monitor.EventRecord
;
import
vion.model.monitor.RAgentEvent
;
import
vion.model.monitor.RMallRemark
;
import
java.time.LocalDateTime
;
import
java.util.List
;
...
...
@@ -83,4 +84,6 @@ public class MallVO {
* 主机名
*/
private
String
hostname
;
private
RMallRemark
mallRemark
;
}
\ 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