Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dcs-doc-expand
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
INET-TWO
server
dcs-doc-expand
Commits
a2c204be
Commit
a2c204be
authored
Nov 19, 2024
by
wangqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卷内目录批量下载功能(暂未调试)
parent
bb4470f4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
0 deletions
+99
-0
ExtFilesController.java
...inet/dcs/document/core/controller/ExtFilesController.java
+16
-0
ExtFilesService.java
...a/com/inet/dcs/document/core/service/ExtFilesService.java
+13
-0
ExtFilesServiceImpl.java
...t/dcs/document/core/service/impl/ExtFilesServiceImpl.java
+70
-0
No files found.
inet-doc-expand-core/src/main/java/com/inet/dcs/document/core/controller/ExtFilesController.java
View file @
a2c204be
...
...
@@ -11,6 +11,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
/**
...
...
@@ -49,6 +51,20 @@ public class ExtFilesController<V extends ExtFilesVO, S extends ExtFilesService<
return
ApiResult
.
ok
(
"生成成功"
);
}
/**
* 批量下载卷内目录
*
* @param response
* @param ids 案卷id集合
* @throws IOException
*/
@ApiOperation
(
value
=
"批量下载卷内目录"
,
notes
=
"批量下载"
,
httpMethod
=
"GET"
)
@GetMapping
(
value
=
"/batchDownloadJNDirDoc"
)
public
void
batchDownloadJNDirDoc
(
HttpServletResponse
response
,
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
throws
IOException
{
extFilesService
.
batchDownloadJNDirDoc
(
response
,
ids
);
}
}
inet-doc-expand-core/src/main/java/com/inet/dcs/document/core/service/ExtFilesService.java
View file @
a2c204be
...
...
@@ -4,6 +4,8 @@ import com.inet.dcs.document.common.vo.ExtFilesVO;
import
com.inet.dcs.document.common.vo.archivesOtherVO.ExtFilesUpdateVO
;
import
com.inet.dcs.document.core.service.shadow.ExtFilesServiceShadow
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.util.List
;
/**
...
...
@@ -51,4 +53,15 @@ public interface ExtFilesService<V extends ExtFilesVO> extends ExtFilesServiceSh
List
<
Long
>
getChildList
(
Long
partId
,
List
<
Long
>
list
);
/**
* 批量下载卷内目录附件
*
* @param response
* @param ids
* @throws IOException
*/
void
batchDownloadJNDirDoc
(
HttpServletResponse
response
,
List
<
Long
>
ids
)
throws
IOException
;
}
inet-doc-expand-core/src/main/java/com/inet/dcs/document/core/service/impl/ExtFilesServiceImpl.java
View file @
a2c204be
package
com
.
inet
.
dcs
.
document
.
core
.
service
.
impl
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.lang.Assert
;
import
cn.hutool.core.util.ZipUtil
;
import
com.inet.dcs.document.common.vo.ExtFilesDocLinkVO
;
import
com.inet.dcs.document.common.vo.ExtFilesVO
;
import
com.inet.dcs.document.common.vo.ExtTransferDocLinkVO
;
...
...
@@ -17,6 +19,7 @@ import com.inet.dcs.document.core.util.SearchUtil;
import
com.inet.dcs.document.core.util.WordUtils
;
import
com.inet.dcs.document.entity.po.ExtFiles
;
import
com.yonde.dcs.document.common.entity.vo.DxDocumentVO
;
import
com.yonde.dcs.plan.common.utils.ResourceHelper
;
import
com.yonde.dex.basedata.data.search.SearchItem
;
import
com.yonde.dex.basedata.data.search.SearchItems
;
import
com.yonde.dex.basedata.data.search.SearchQueryBuilder
;
...
...
@@ -31,7 +34,9 @@ import com.yonde.dex.dao.service.DxDaoPluginExpander;
import
com.yonde.dex.dfs.feign.FileManagerFeignService
;
import
com.yonde.dex.dfs.objfilelink.enums.FileTypeEnum
;
import
com.yonde.dex.dfs.objfilelink.plugin.core.util.DxObjFileUtils
;
import
com.yonde.dex.dfs.vo.ObjFileLinkVO
;
import
com.yonde.dex.dfs.vo.RepoFileVO
;
import
com.yonde.dex.dfs.vo.view.FileDownLoadInfoVO
;
import
com.yonde.dex.dict.feign.DictDataFeignService
;
import
com.yonde.dex.dict.service.vo.DictDataVO
;
import
com.yonde.dex.feign.applink.DxAppModelDefLinkFeignService
;
...
...
@@ -49,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.nio.file.Files
;
import
java.util.*
;
...
...
@@ -589,6 +595,70 @@ public class ExtFilesServiceImpl<V extends ExtFilesVO> implements ExtFilesServic
return
extFilesVO
.
getVolumeNumber
()
+
"_备考表("
+
secretCode
+
")"
;
}
/**
* 批量下载卷内目录
* @param response
* @param ids
* @throws IOException
*/
@Override
public
void
batchDownloadJNDirDoc
(
HttpServletResponse
response
,
List
<
Long
>
ids
)
throws
IOException
{
if
(
CollUtil
.
isEmpty
(
ids
)){
throw
new
DxBusinessException
(
"500"
,
"必须要选中一条案卷"
);
}
//临时文件目录
String
tempDir
=
ResourceHelper
.
createTempDir
().
getPath
();
//文件id集合
List
<
Long
>
fileIds
=
new
ArrayList
<>();
//查询所有案卷下所有的附件并展开
SearchQueryCondition
queryCondition
=
SearchUtil
.
buildQueryWithOpenAttr
(
"id"
,
SearchItem
.
Operator
.
IN
,
ids
,
"objFileLinks.target"
);
List
<
ExtFilesVO
>
content
=
(
List
<
ExtFilesVO
>)
this
.
findRecursion
(
queryCondition
).
getContent
();
if
(
CollUtil
.
isNotEmpty
(
content
)){
for
(
ExtFilesVO
extFilesVO:
content
){
List
<
ObjFileLinkVO
>
objFileLinks
=
extFilesVO
.
getObjFileLinks
();
if
(
CollUtil
.
isNotEmpty
(
extFilesVO
.
getObjFileLinks
())){
//遍历取出文件id
objFileLinks
.
stream
().
forEach
(
o
->
{
fileIds
.
add
(
o
.
getTargetId
());
});
}
}
}
if
(
fileIds
.
size
()
>
0
){
fileIds
.
stream
().
forEach
(
fileId
->
{
try
{
//通过fileId下载文件
FileDownLoadInfoVO
fileDownLoadInfoVO
=
fileManagerFeignService
.
download
(
fileId
);
com
.
yonde
.
dcs
.
plan
.
common
.
utils
.
FileUtils
.
base64ToFile
(
fileDownLoadInfoVO
.
getFileBase64
(),
fileDownLoadInfoVO
.
getFileName
(),
tempDir
);
}
catch
(
Exception
e
)
{
throw
new
DxBusinessException
(
"-1"
,
"批量下载文件失败"
+
e
.
getMessage
());
}
});
//压缩文件
downloadDataZip
(
response
,
tempDir
);
//删除生成后的临时文件
FileUtils
.
deleteDirectory
(
tempDir
);
}
}
/**
* 批量下载季报报表文件
*
* @param response
* @param dir
* @throws IOException
*/
private
void
downloadDataZip
(
HttpServletResponse
response
,
String
dir
)
throws
IOException
{
File
zip
=
ZipUtil
.
zip
(
dir
);
InputStream
inputStream
=
FileUtils
.
fileToInputStream
(
zip
);
com
.
yonde
.
dcs
.
plan
.
common
.
utils
.
FileUtils
.
downloadFile
(
response
,
inputStream
,
"卷内目录"
);
}
}
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