Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
wyszyk
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
任建彩
wyszyk
Commits
ddb43059
提交
ddb43059
authored
4月 20, 2022
作者:
任建彩
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat:图书关联全部资源、图书关联系列
1.resource
上级
c8ef8544
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
118 行增加
和
1 行删除
+118
-1
ZipUtil.java
...szyk-common-util/src/main/java/com/zrqx/util/ZipUtil.java
+16
-0
FileController.java
...java/com/zrqx/file/controller/backend/FileController.java
+9
-0
EbookController.java
...com/zrqx/resource/controller/backend/EbookController.java
+5
-1
EbookMapper.java
...main/java/com/zrqx/resource/mapper/ebook/EbookMapper.java
+8
-0
QueryEbookInfoForm.java
...om/zrqx/resource/model/form/ebook/QueryEbookInfoForm.java
+2
-0
ResourceRelationVO.java
...n/java/com/zrqx/resource/model/vo/ResourceRelationVO.java
+3
-0
EbookService.java
...src/main/java/com/zrqx/resource/service/EbookService.java
+7
-0
EbookServiceImpl.java
...java/com/zrqx/resource/service/impl/EbookServiceImpl.java
+31
-0
ResourceRelationServiceImpl.java
...qx/resource/service/impl/ResourceRelationServiceImpl.java
+3
-0
Reyo.java
...-resource/src/main/java/com/zrqx/resource/utils/Reyo.java
+34
-0
没有找到文件。
wyszyk-common/wyszyk-common-util/src/main/java/com/zrqx/util/ZipUtil.java
浏览文件 @
ddb43059
...
...
@@ -58,7 +58,23 @@ public class ZipUtil {
System
.
out
.
println
(
"压缩完成"
);
return
zipFileName
;
}
public
static
String
wholeZip
(
String
rootPath
,
List
<
FileInfo
>
list
,
String
name
)
throws
Exception
{
// File zipFile = new File(zipFileName);
System
.
out
.
println
(
"压缩中..."
);
String
zipFileName
=
rootPath
+
name
+
".zip"
;
// 创建zip输出流
ZipOutputStream
out
=
new
ZipOutputStream
(
new
BufferedOutputStream
(
new
FileOutputStream
(
zipFileName
)));
for
(
FileInfo
file
:
list
)
{
String
filePath
=
rootPath
+
file
.
getPath
()
+
"/"
+
file
.
getFileName
()
+
file
.
getSuffixName
();
File
sourceFile
=
new
File
(
filePath
);
compress
(
out
,
sourceFile
,
sourceFile
.
getName
());
}
out
.
close
();
System
.
out
.
println
(
"压缩完成"
);
return
zipFileName
;
}
public
static
void
compress
(
ZipOutputStream
out
,
File
sourceFile
,
String
base
)
throws
Exception
{
// 如果路径为目录(文件夹)
if
(
sourceFile
.
isDirectory
())
{
...
...
wyszyk-provider/wyszyk-provider-file/src/main/java/com/zrqx/file/controller/backend/FileController.java
浏览文件 @
ddb43059
...
...
@@ -300,6 +300,15 @@ public class FileController {
List
<
FileInfo
>
list
=
service
.
list
(
queryWrapper
);
return
ZipUtil
.
zip
(
rootPath
,
BeanUtils
.
copyList
(
list
,
com
.
zrqx
.
core
.
vo
.
FileInfo
.
class
));
}
@ApiOperation
(
value
=
"全部资源下载zip"
)
@RequestMapping
(
value
=
"/wholeDownload/zip"
,
method
=
RequestMethod
.
POST
)
public
String
downLoad
(
@RequestBody
List
<
String
>
fileNames
,
String
name
)
throws
Exception
{
LambdaQueryWrapper
<
FileInfo
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
in
(
FileInfo:
:
getFileName
,
fileNames
);
List
<
FileInfo
>
list
=
service
.
list
(
queryWrapper
);
// return ZipUtil.zip(rootPath, BeanUtils.copyList(list, com.zrqx.core.vo.FileInfo.class));
return
ZipUtil
.
wholeZip
(
rootPath
,
BeanUtils
.
copyList
(
list
,
com
.
zrqx
.
core
.
vo
.
FileInfo
.
class
),
name
);
}
@ApiOperation
(
value
=
"导出二维码zip"
)
@RequestMapping
(
value
=
"/download/zip"
,
method
=
RequestMethod
.
GET
)
public
String
downLoad
(
HttpServletResponse
response
,
String
fileName
)
throws
Exception
{
...
...
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/controller/backend/EbookController.java
浏览文件 @
ddb43059
...
...
@@ -345,7 +345,11 @@ public class EbookController {
public
CallBack
<
PageInfo
<
EbookListVO
>>
getBookList
(
QueryEbookInfoForm
form
,
PageParam
pageParam
)
{
return
CallBack
.
success
(
ebookservice
.
page
(
form
,
pageParam
));
}
@ApiOperation
(
"电子书搜索补全"
)
@GetMapping
(
"/bookList"
)
public
CallBack
<
List
<
EbookListVO
>>
getBookNameList
(
QueryEbookInfoForm
form
)
{
return
CallBack
.
success
(
ebookservice
.
getBookNameList
(
form
));
}
@ApiOperation
(
value
=
"筛选列表"
,
notes
=
"筛选条件列表"
)
@GetMapping
(
value
=
"/option/list"
)
public
CallBack
<
Map
<
String
,
String
>>
queryOptionList
()
{
...
...
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/mapper/ebook/EbookMapper.java
浏览文件 @
ddb43059
...
...
@@ -39,6 +39,7 @@ public interface EbookMapper extends BaseMapper<Ebook> {
+
" LEFT JOIN res_ebook be ON bb.id = be.id "
+
" LEFT JOIN res_ebook_diy_type bdt ON be.id = bdt.ebookid"
+
" LEFT JOIN ( SELECT resourceId,author,authorId FROM res_relation_author GROUP BY resourceId HAVING MIN(id)) ba ON bb.id = ba.resourceId "
+
" LEFT JOIN res_project_model_resource rr ON bb.id = rr.resourceId "
+
" WHERE 1 = 1 "
+
"<if test='form.option == 1'>"
+
" AND (ba.author IS NULL OR ba.author = '') "
...
...
@@ -72,6 +73,7 @@ public interface EbookMapper extends BaseMapper<Ebook> {
+
" AND be.createdTime <= concat(#{form.endTime}, ' 23:59:59')"
+
"</if>"
+
" rlike(bb.departmentCode,form.departmentCode) "
+
" eq(rr.projectId,form.projectId) "
+
"</script>"
)
List
<
EbookListVO
>
page
(
@Param
(
"form"
)
QueryEbookInfoForm
form
);
...
...
@@ -338,4 +340,10 @@ public interface EbookMapper extends BaseMapper<Ebook> {
+
" rlike(ld.labelContentDiyTypeCode,form.labelContentDiyTypeCode) "
+
"</script>"
)
List
<
ResourceListInfoVO
>
searchResource
(
@Param
(
"form"
)
ResourceQueryForm
form
);
@Select
(
"<script>"
+
"SELECT bb.id,bb.name FROM res_book bb WHERE 1=1 "
+
" like(bb.name,form.name)"
+
" rlike(bb.departmentCode,form.departmentCode) "
+
"</script>"
)
List
<
EbookListVO
>
getBookNameList
(
@Param
(
"form"
)
QueryEbookInfoForm
form
);
}
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/model/form/ebook/QueryEbookInfoForm.java
浏览文件 @
ddb43059
...
...
@@ -31,6 +31,8 @@ public class QueryEbookInfoForm {
private
List
<
Integer
>
diyTypeId
;
@ApiModelProperty
(
"自定义分类code"
)
private
String
diyTypeCode
;
@ApiModelProperty
(
"系列"
)
private
String
projectId
;
@ApiModelProperty
(
"0全部1电子书2实体书"
)
private
Integer
bookType
;
...
...
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/model/vo/ResourceRelationVO.java
浏览文件 @
ddb43059
...
...
@@ -17,6 +17,8 @@ public class ResourceRelationVO {
private
String
objectId
;
@ApiModelProperty
(
"资源名"
)
private
String
name
;
@ApiModelProperty
(
"文件fileName"
)
private
String
fileName
;
@ApiModelProperty
(
"封面"
)
private
String
cover
;
@ApiModelProperty
(
"讲师"
)
...
...
@@ -45,6 +47,7 @@ public class ResourceRelationVO {
private
Integer
sort
;
@ApiModelProperty
(
"播放数,默认值:0"
)
private
Integer
browseNum
;
//查看全部资源需要
@ApiModelProperty
(
value
=
"资源包下关联的资源"
)
private
List
<
ResourceRelationVO
>
resourceList
;
...
...
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/service/EbookService.java
浏览文件 @
ddb43059
...
...
@@ -282,4 +282,11 @@ public interface EbookService extends IService<Ebook> {
* @return Boolean
*/
Boolean
updateReaderNum
(
String
oid
);
/**
* 根据图书名搜索补全
* @param: ${tags}
* @author rjc
* @date 2022/4/20 15:48
*/
List
<
EbookListVO
>
getBookNameList
(
QueryEbookInfoForm
form
);
}
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/service/impl/EbookServiceImpl.java
浏览文件 @
ddb43059
...
...
@@ -62,6 +62,7 @@ import com.zrqx.resource.model.vo.ebook.ExcelBookExportVo;
import
com.zrqx.resource.model.vo.ebook.ExcelEbookImportVo
;
import
com.zrqx.resource.service.*
;
import
com.zrqx.resource.solr.SolrManage
;
import
com.zrqx.resource.utils.Reyo
;
import
com.zrqx.util.datatype.ArrayUtils
;
import
com.zrqx.util.datatype.DateUtils
;
import
com.zrqx.util.datatype.StringUtil
;
...
...
@@ -1156,6 +1157,36 @@ public class EbookServiceImpl extends ServiceImpl<EbookMapper, Ebook> implements
return
update
(
wrapper
);
}
@Override
public
List
<
EbookListVO
>
getBookNameList
(
QueryEbookInfoForm
form
)
{
ObjectMapper
mapper1
=
new
ObjectMapper
();
String
jsonString
=
systemAdminClient
.
infoJson
(
Integer
.
parseInt
(
tokenManager
.
getUserId
()));
try
{
SystemAdmin
systemAdmin
=
mapper1
.
readValue
(
jsonString
,
SystemAdmin
.
class
);
if
(
systemAdmin
!=
null
)
{
if
(
systemAdmin
.
getRoles
().
contains
(
","
))
{
List
<
String
>
list
=
Arrays
.
asList
(
systemAdmin
.
getRoles
().
split
(
","
));
boolean
b
=
list
.
stream
().
anyMatch
(
s
->
s
.
equals
(
"1"
));
if
(!
b
)
{
form
.
setDepartmentCode
(
systemAdmin
.
getDepartmentCode
());
}
}
else
{
if
(!
systemAdmin
.
getRoles
().
equals
(
"1"
))
{
form
.
setDepartmentCode
(
systemAdmin
.
getDepartmentCode
());
}
}
}
}
catch
(
JsonProcessingException
e
)
{
e
.
printStackTrace
();
}
List
<
EbookListVO
>
list
=
ebookMapper
.
getBookNameList
(
form
);
/*for (EbookListVO vo:list) {
String name = Reyo.IgnoreCaseReplace(vo.getName(),form.getName());
vo.setName(name);
}*/
return
list
;
}
/**
* 机构会员,查询是否有查看该资源的权限
*
...
...
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/service/impl/ResourceRelationServiceImpl.java
浏览文件 @
ddb43059
...
...
@@ -156,6 +156,7 @@ public class ResourceRelationServiceImpl extends ServiceImpl<ResourceRelationMap
e
.
setResourceType_zh
(
AllResourceTypeEnum
.
VIDEO
.
getName
());
e
.
setStatus
(
vl
.
getStatus
());
e
.
setStatus_zh
(
LibraryStatusEnum
.
getName
(
vl
.
getStatus
()));
e
.
setFileName
(
vl
.
getVideo
());
}
}
if
(
e
.
getResourceType
().
equals
(
AllResourceTypeEnum
.
AUDIO
.
getCode
()))
{
...
...
@@ -170,6 +171,7 @@ public class ResourceRelationServiceImpl extends ServiceImpl<ResourceRelationMap
e
.
setSize
(
al
.
getSize
());
e
.
setStatus_zh
(
LibraryStatusEnum
.
getName
(
al
.
getStatus
()));
e
.
setBrowseNum
(
al
.
getBrowseNum
());
e
.
setFileName
(
al
.
getAudio
());
}
}
if
(
e
.
getResourceType
().
equals
(
AllResourceTypeEnum
.
IMAGE
.
getCode
()))
{
...
...
@@ -243,6 +245,7 @@ public class ResourceRelationServiceImpl extends ServiceImpl<ResourceRelationMap
PdfLibrary
pdfLibrary
=
pdfLibraryMapper
.
selectById
(
e
.
getResourceId
());
if
(
pdfLibrary
!=
null
)
{
e
.
setName
(
pdfLibrary
.
getName
());
e
.
setFileName
(
pdfLibrary
.
getPdf
());
}
}
}
...
...
wyszyk-provider/wyszyk-provider-resource/src/main/java/com/zrqx/resource/utils/Reyo.java
0 → 100644
浏览文件 @
ddb43059
package
com
.
zrqx
.
resource
.
utils
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
Reyo
{
/**
* @param args
*/
public
static
void
main
(
String
[]
args
)
{
String
source
=
"aa reyo Reyo bb rEYO"
;
String
patternstring
=
"reyo"
;
System
.
out
.
println
(
IgnoreCaseReplace
(
source
,
patternstring
));
}
/**
* java实现不区分大小写高亮替换
* @param source
* @param patternstring
* @return
*/
public
static
String
IgnoreCaseReplace
(
String
source
,
String
patternstring
)
{
Pattern
p
=
Pattern
.
compile
(
patternstring
,
Pattern
.
CASE_INSENSITIVE
);
Matcher
mc
=
p
.
matcher
(
source
);
StringBuffer
sb
=
new
StringBuffer
();
while
(
mc
.
find
())
{
mc
.
appendReplacement
(
sb
,
"<font color='red' >"
+
mc
.
group
()
+
"</font>"
);
}
mc
.
appendTail
(
sb
);
return
sb
.
toString
();
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论