Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wyszyk
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
任建彩
wyszyk
Commits
8b7e0373
提交
8b7e0373
authored
8月 08, 2022
作者:
任建彩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:关联内容
1.resource
上级
52531222
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
28 行增加
和
17 行删除
+28
-17
GoodsLibraryController.java
...x/resource/controller/backend/GoodsLibraryController.java
+25
-12
UpdateZipForm.java
.../zrqx/resource/model/form/goodslibrary/UpdateZipForm.java
+0
-2
ResourceRelationServiceImpl.java
...qx/resource/service/impl/ResourceRelationServiceImpl.java
+3
-3
没有找到文件。
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/controller/backend/GoodsLibraryController.java
浏览文件 @
8b7e0373
...
...
@@ -25,6 +25,7 @@ import com.zrqx.resource.model.vo.goodslibrary.GoodsLibraryListVO;
import
com.zrqx.resource.model.vo.goodslibrary.GoodsLibraryVO
;
import
com.zrqx.resource.service.*
;
import
com.zrqx.resource.solr.SolrManage
;
import
com.zrqx.util.datatype.StringUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.BeanUtils
;
...
...
@@ -33,6 +34,7 @@ import org.springframework.web.bind.annotation.*;
import
javax.annotation.Resource
;
import
javax.validation.Valid
;
import
java.io.File
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
...
...
@@ -85,18 +87,29 @@ public class GoodsLibraryController {
@PostMapping
(
value
=
"/updateZip"
)
public
CallBack
<
Boolean
>
updateZip
(
@RequestBody
UpdateZipForm
form
)
throws
Exception
{
GoodsLibrary
goodsLibrary
=
service
.
getById
(
form
.
getId
());
//批量获取关联资源的文件fileName
QueryResourceRelationForm
entity
=
new
QueryResourceRelationForm
();
entity
.
setId
(
form
.
getId
());
List
<
ResourceRelationVO
>
list
=
resourceRelationService
.
queryByIdAndResourceType
(
entity
);
List
<
String
>
fileNames
=
resourceRelationService
.
queryRelationFileNameList
(
list
);
FileDownloadForm
fileForm
=
new
FileDownloadForm
();
fileForm
.
setFileNames
(
fileNames
);
fileForm
.
setName
(
goodsLibrary
.
getName
());
//打包zip
String
zipFileName
=
fileClient
.
wholeDownload
(
fileForm
);
goodsLibrary
.
setFileName
(
zipFileName
);
return
CallBack
.
success
(
service
.
updateById
(
goodsLibrary
));
if
(
goodsLibrary
!=
null
)
{
if
(
StringUtils
.
isNotBlank
(
goodsLibrary
.
getFileName
()))
{
String
path
=
"/opt/upload/wyzyk/"
+
goodsLibrary
.
getFileName
();
File
file
=
new
File
(
path
);
if
(
file
.
exists
()
&&
file
.
isDirectory
())
{
String
[]
cmd
=
new
String
[]{
"/bin/sh"
,
"-c"
,
"rm -rf "
+
path
};
Runtime
.
getRuntime
().
exec
(
cmd
);
}
}
//批量获取关联资源的文件fileName
QueryResourceRelationForm
entity
=
new
QueryResourceRelationForm
();
entity
.
setId
(
form
.
getId
());
List
<
ResourceRelationVO
>
list
=
resourceRelationService
.
queryByIdAndResourceType
(
entity
);
List
<
String
>
fileNames
=
resourceRelationService
.
queryRelationFileNameList
(
list
);
FileDownloadForm
fileForm
=
new
FileDownloadForm
();
fileForm
.
setFileNames
(
fileNames
);
fileForm
.
setName
(
goodsLibrary
.
getName
());
//打包zip
String
zipFileName
=
fileClient
.
wholeDownload
(
fileForm
);
goodsLibrary
.
setFileName
(
zipFileName
);
service
.
updateById
(
goodsLibrary
);
}
return
CallBack
.
success
(
true
);
}
@ApiOperation
(
value
=
"查询关联File文件"
,
notes
=
"查询关联File文件"
)
@GetMapping
(
value
=
"/getRelationFile"
)
...
...
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/model/form/goodslibrary/UpdateZipForm.java
浏览文件 @
8b7e0373
...
...
@@ -9,6 +9,4 @@ import lombok.Data;
public
class
UpdateZipForm
{
@ApiModelProperty
(
"商品id,新增时不需要填写"
)
private
String
id
;
@ApiModelProperty
(
"zip文件名称"
)
private
String
fileName
;
}
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/service/impl/ResourceRelationServiceImpl.java
浏览文件 @
8b7e0373
...
...
@@ -295,14 +295,14 @@ public class ResourceRelationServiceImpl extends ServiceImpl<ResourceRelationMap
if
(
e
.
getResourceType
()
!=
null
)
{
if
(
e
.
getResourceType
().
equals
(
AllResourceTypeEnum
.
VIDEO
.
getCode
()))
{
VideoLibrary
vl
=
videoLibraryMapper
.
selectById
(
e
.
getResourceId
());
if
(
vl
!=
null
&&
vl
.
getIsDownload
().
equals
(
"0"
))
{
if
(
vl
!=
null
&&
vl
.
getIsDownload
().
equals
(
"0"
)
&&
StringUtils
.
isNotBlank
(
vl
.
getVideo
())
)
{
e
.
setFileName
(
vl
.
getVideo
());
listFile
.
add
(
e
.
getFileName
());
}
}
if
(
e
.
getResourceType
().
equals
(
AllResourceTypeEnum
.
AUDIO
.
getCode
()))
{
AudioLibrary
al
=
audioLibraryMapper
.
selectById
(
e
.
getResourceId
());
if
(
al
!=
null
&&
al
.
getIsDownload
().
equals
(
"0"
))
{
if
(
al
!=
null
&&
al
.
getIsDownload
().
equals
(
"0"
)
&&
StringUtils
.
isNotBlank
(
al
.
getAudio
())
)
{
e
.
setFileName
(
al
.
getAudio
());
listFile
.
add
(
e
.
getFileName
());
}
...
...
@@ -310,7 +310,7 @@ public class ResourceRelationServiceImpl extends ServiceImpl<ResourceRelationMap
//pdf
if
(
e
.
getResourceType
().
equals
(
AllResourceTypeEnum
.
PDF
.
getCode
()))
{
PdfLibrary
pdfLibrary
=
pdfLibraryMapper
.
selectById
(
e
.
getResourceId
());
if
(
pdfLibrary
!=
null
&&
pdfLibrary
.
getIsDownload
().
equals
(
"0"
))
{
if
(
pdfLibrary
!=
null
&&
pdfLibrary
.
getIsDownload
().
equals
(
"0"
)
&&
StringUtils
.
isNotBlank
(
pdfLibrary
.
getPdf
())
)
{
e
.
setFileName
(
pdfLibrary
.
getPdf
());
listFile
.
add
(
e
.
getFileName
());
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论