Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
test
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
邬友楠
test
Commits
65172649
Commit
65172649
authored
Mar 09, 2021
by
雍欢
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
改造附件下载逻辑、删除逻辑、复制逻辑、修改排序号逻辑
parent
eaff27b8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
13 deletions
+28
-13
AttachmentApplicationImpl.java
...ttachment/application/impl/AttachmentApplicationImpl.java
+28
-13
No files found.
huigou-uasp/src/main/java/com/huigou/uasp/bmp/doc/attachment/application/impl/AttachmentApplicationImpl.java
View file @
65172649
...
...
@@ -57,7 +57,6 @@ public class AttachmentApplicationImpl extends BaseApplication implements Attach
attachmentConfiguration
.
buildDetails
();
attachmentConfiguration
=
(
AttachmentConfiguration
)
this
.
commonDomainService
.
saveBaseInfoWithFolderEntity
(
attachmentConfiguration
,
configurationRepository
);
return
attachmentConfiguration
.
getId
();
}
...
...
@@ -153,10 +152,8 @@ public class AttachmentApplicationImpl extends BaseApplication implements Attach
@Transactional
public
void
deleteAttachment
(
String
id
,
Boolean
verifyCreator
)
{
this
.
checkIdNotBlank
(
id
);
List
<
String
>
ids
=
new
ArrayList
<
String
>(
1
);
List
<
String
>
ids
=
new
ArrayList
<>(
1
);
ids
.
add
(
id
);
deleteAttachmentsByIds
(
ids
,
verifyCreator
);
}
...
...
@@ -168,6 +165,7 @@ public class AttachmentApplicationImpl extends BaseApplication implements Attach
throw
new
ApplicationException
(
"不能删除其他人上传的文件。"
);
}
}
checkAttachmentSecretLevel
(
attachment
);
attachment
.
setStatus
(
Attachment
.
Status
.
DELETED
.
getId
());
}
...
...
@@ -181,7 +179,6 @@ public class AttachmentApplicationImpl extends BaseApplication implements Attach
List
<
Attachment
>
attachments
=
this
.
attachmentRepository
.
findAll
(
ids
);
Assert
.
notNull
(
ids
.
size
()
==
attachments
.
size
(),
MessageSourceContext
.
getMessage
(
MessageConstants
.
IDS_EXIST_INVALID_ID
,
"附件"
));
internalDeleteAttachments
(
attachments
,
verifyCreator
);
}
...
...
@@ -202,12 +199,17 @@ public class AttachmentApplicationImpl extends BaseApplication implements Attach
@Override
public
Attachment
loadAttachment
(
String
id
)
{
this
.
checkIdNotBlank
(
id
);
return
this
.
attachmentRepository
.
findOne
(
id
);
Attachment
attachment
=
this
.
attachmentRepository
.
findOne
(
id
);
checkAttachmentSecretLevel
(
attachment
);
return
attachment
;
}
@Override
public
void
updateAttachmentsSequence
(
Map
<
String
,
Integer
>
params
)
{
Assert
.
notEmpty
(
params
,
"参数params不能为空。"
);
params
.
keySet
().
stream
().
map
(
attachmentRepository:
:
findOne
)
.
forEach
(
this
::
checkAttachmentSecretLevel
);
this
.
commonDomainService
.
updateSequence
(
Attachment
.
class
,
params
);
}
...
...
@@ -220,17 +222,26 @@ public class AttachmentApplicationImpl extends BaseApplication implements Attach
return
attachments
;
}
AttachmentConfiguration
attachmentConfiguration
=
attachmentConfigurationRepository
.
findByCode
(
bizKindId
);
if
(
attachmentConfiguration
!=
null
)
{
if
(
Objects
.
equals
(
attachmentConfiguration
.
getEnableSecret
(),
1
))
{
Person
person
=
orgApplication
.
loadPerson
(
ThreadLocalUtil
.
getOperator
().
getUserId
());
return
attachments
.
stream
()
.
filter
(
attachment
->
matchingSecretLevel
(
person
,
attachment
))
.
collect
(
Collectors
.
toList
());
}
if
(
attachmentConfiguration
!=
null
&&
Objects
.
equals
(
attachmentConfiguration
.
getEnableSecret
(),
1
))
{
Person
person
=
orgApplication
.
loadPerson
(
ThreadLocalUtil
.
getOperator
().
getUserId
());
return
attachments
.
stream
()
.
filter
(
attachment
->
matchingSecretLevel
(
person
,
attachment
))
.
collect
(
Collectors
.
toList
());
}
return
attachments
;
}
private
void
checkAttachmentSecretLevel
(
Attachment
attachment
)
{
if
(
attachment
==
null
)
{
return
;
}
AttachmentConfiguration
attachmentConfiguration
=
attachmentConfigurationRepository
.
findByCode
(
attachment
.
getBizKindId
());
if
(
attachmentConfiguration
!=
null
&&
Objects
.
equals
(
attachmentConfiguration
.
getEnableSecret
(),
1
))
{
Person
person
=
orgApplication
.
loadPerson
(
ThreadLocalUtil
.
getOperator
().
getUserId
());
Assert
.
isTrue
(
matchingSecretLevel
(
person
,
attachment
),
String
.
format
(
"人员密级[%s]与附件密级[%s]不匹配"
,
person
.
getPersonSecurityGrade
(),
attachment
.
getSecretLevel
()));
}
}
/**
* 判断人员密级是否与附件密级匹配
*/
...
...
@@ -314,6 +325,7 @@ public class AttachmentApplicationImpl extends BaseApplication implements Attach
String
sql
=
queryDescriptor
.
getSqlByName
(
"loadById"
);
Map
<
String
,
Object
>
map
=
this
.
sqlExecutorDao
.
queryToMap
(
sql
,
fileId
);
Assert
.
notEmpty
(
map
,
"文件不存在,可能被其他用户删除或修改!"
);
checkAttachmentSecretLevel
(
attachmentRepository
.
findOne
(
fileId
));
BatchSqlUpdateDetail
batchInsertDetail
=
this
.
getBatchInsertDetail
();
String
path
=
null
;
Operator
op
=
ThreadLocalUtil
.
getVariable
(
"operator"
,
Operator
.
class
);
...
...
@@ -355,6 +367,9 @@ public class AttachmentApplicationImpl extends BaseApplication implements Attach
if
(
objs
==
null
||
objs
.
size
()
==
0
)
{
return
;
}
objs
.
stream
().
map
(
f
->
(
String
)
f
.
get
(
"id"
))
.
map
(
attachmentRepository:
:
findOne
)
.
forEach
(
this
::
checkAttachmentSecretLevel
);
BatchSqlUpdateDetail
batchInsertDetail
=
this
.
getBatchInsertDetail
();
String
path
=
null
;
Operator
op
=
ThreadLocalUtil
.
getVariable
(
"operator"
,
Operator
.
class
);
...
...
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