Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zgzx
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
zgzx
Commits
6a75b7b0
提交
6a75b7b0
authored
9月 11, 2019
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
2ddc41d3
隐藏空白字符变更
内嵌
并排
正在显示
15 个修改的文件
包含
21 行增加
和
267 行删除
+21
-267
LibraryStatusEnum.java
.../java/com/zrqx/core/enums/resource/LibraryStatusEnum.java
+1
-3
BatchUpdateArticleLibraryForm.java
...urce/bg/articlelibrary/BatchUpdateArticleLibraryForm.java
+1
-7
QueryArticleLibraryForm.java
...m/resource/bg/articlelibrary/QueryArticleLibraryForm.java
+2
-8
SaveUpdateArticleLibraryForm.java
...ource/bg/articlelibrary/SaveUpdateArticleLibraryForm.java
+0
-17
UpdateEbookForm.java
...com/zrqx/core/form/resource/bg/ebook/UpdateEbookForm.java
+0
-2
ArticleLibrary.java
...qx/core/model/resource/articlelibrary/ArticleLibrary.java
+1
-1
ArticleLibraryDiyType.java
.../model/resource/articlelibrary/ArticleLibraryDiyType.java
+3
-2
PdfLibraryDiyType.java
...core/model/resource/pdffilelibrary/PdfLibraryDiyType.java
+1
-1
ArticleLibraryListVO.java
...core/vo/resource/articlelibrary/ArticleLibraryListVO.java
+2
-16
ArticleLibraryController.java
...g/controller/articlelibrary/ArticleLibraryController.java
+6
-112
EbookController.java
...om/zrqx/resource/bg/controller/ebook/EbookController.java
+0
-61
PdfLibraryController.java
...ce/bg/controller/pdffilelibrary/PdfLibraryController.java
+0
-2
ResourceLibraryController.java
...controller/resourcelibrary/ResourceLibraryController.java
+0
-1
ArticleLibraryMapper.java
...source/bg/mapper/articlelibrary/ArticleLibraryMapper.java
+3
-15
ArticleLibrarySerivceImpl.java
.../bg/service/articlelibrary/ArticleLibrarySerivceImpl.java
+1
-19
没有找到文件。
com.zrqx.core/src/main/java/com/zrqx/core/enums/resource/LibraryStatusEnum.java
浏览文件 @
6a75b7b0
...
...
@@ -10,12 +10,10 @@ import java.util.HashMap;
*/
public
enum
LibraryStatusEnum
{
/** 已录入 */
STATUS_0
(
0
,
"已录入"
),
/** 已上架*/
STATUS_1
(
1
,
"已上架"
),
/** 未上架 */
STATUS_
2
(
2
,
"未上架"
);
STATUS_
0
(
0
,
"未上架"
);
private
final
Integer
code
;
private
final
String
name
;
...
...
com.zrqx.core/src/main/java/com/zrqx/core/form/resource/bg/articlelibrary/BatchUpdateArticleLibraryForm.java
浏览文件 @
6a75b7b0
package
com
.
zrqx
.
core
.
form
.
resource
.
bg
.
articlelibrary
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType
;
...
...
@@ -17,10 +16,5 @@ public class BatchUpdateArticleLibraryForm {
private
Integer
status
;
@ApiModelProperty
(
value
=
"分类id"
)
private
List
<
ArticleLibraryDiyType
>
diyType
;
@ApiModelProperty
(
"定价"
)
private
BigDecimal
price
;
@ApiModelProperty
(
"售价"
)
private
BigDecimal
realPrice
;
@ApiModelProperty
(
"全文阅读权限 0 游客可见 1会员可见"
)
private
Integer
readTextPower
;
}
com.zrqx.core/src/main/java/com/zrqx/core/form/resource/bg/articlelibrary/QueryArticleLibraryForm.java
浏览文件 @
6a75b7b0
...
...
@@ -8,13 +8,9 @@ import lombok.Data;
@Data
@ApiModel
(
value
=
"QueryArticleLibraryForm"
,
description
=
"文章库"
)
public
class
QueryArticleLibraryForm
{
@ApiModelProperty
(
value
=
"文章标题"
)
@ApiModelProperty
(
value
=
"文章标题
、作者、所属杂志
"
)
private
String
name
;
@ApiModelProperty
(
"作者"
)
private
String
author
;
@ApiModelProperty
(
"所属图书"
)
private
String
source
;
@ApiModelProperty
(
"状态:0待审核,1已上架,2已下架"
)
@ApiModelProperty
(
"状态:0已下架,1已上架"
)
private
String
status
;
@ApiModelProperty
(
value
=
"上传时间-开始"
)
private
String
beginTime
;
...
...
@@ -24,6 +20,4 @@ public class QueryArticleLibraryForm {
private
List
<
Integer
>
diyTypeId
;
@ApiModelProperty
(
"自定义分类code"
)
private
String
diyTypeCode
;
@ApiModelProperty
(
"资源类型 0全部 1图书、2医家、3文章、4图片、5视频、6音频、7附件资源 "
)
private
Integer
resourceType
;
}
com.zrqx.core/src/main/java/com/zrqx/core/form/resource/bg/articlelibrary/SaveUpdateArticleLibraryForm.java
浏览文件 @
6a75b7b0
...
...
@@ -23,8 +23,6 @@ public class SaveUpdateArticleLibraryForm {
private
String
source
;
@ApiModelProperty
(
"关键词"
)
private
String
keywords
;
@ApiModelProperty
(
"定价"
)
private
BigDecimal
price
;
@ApiModelProperty
(
"简介"
)
private
String
synopsis
;
@ApiModelProperty
(
"正文"
)
...
...
@@ -33,23 +31,8 @@ public class SaveUpdateArticleLibraryForm {
private
String
pdf
;
@ApiModelProperty
(
"封面"
)
private
String
img
;
@ApiModelProperty
(
"音频文件"
)
private
String
audio
;
@ApiModelProperty
(
"视频文件"
)
private
String
video
;
@ApiModelProperty
(
"售价"
)
private
BigDecimal
realPrice
;
@ApiModelProperty
(
"全文阅读权限 0 游客可见 1会员可见"
)
private
Integer
readTextPower
;
@ApiModelProperty
(
value
=
"分类id"
)
private
List
<
ArticleLibraryDiyType
>
diyType
;
@ApiModelProperty
(
value
=
"预览文章"
)
private
String
previewText
;
@ApiModelProperty
(
"售价选项 0 免费,1收费"
)
private
Integer
priceOption
;
@ApiModelProperty
(
"pdf名称"
)
private
String
pdfName
;
@ApiModelProperty
(
value
=
"作者名称和id(用,隔开)"
)
private
String
authorNameAndId
;
}
com.zrqx.core/src/main/java/com/zrqx/core/form/resource/bg/ebook/UpdateEbookForm.java
浏览文件 @
6a75b7b0
...
...
@@ -2,8 +2,6 @@ package com.zrqx.core.form.resource.bg.ebook;
import
java.util.List
;
import
com.zrqx.core.model.resource.ebook.EbookDiyType
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
com.zrqx.core/src/main/java/com/zrqx/core/model/resource/articlelibrary/ArticleLibrary.java
浏览文件 @
6a75b7b0
...
...
@@ -37,7 +37,7 @@ public class ArticleLibrary {
private
String
text
;
@ApiModelProperty
(
"pdf"
)
private
String
pdf
;
@ApiModelProperty
(
"状态:0
待审核,1已上架,2已下
架"
)
@ApiModelProperty
(
"状态:0
已下架、1已上
架"
)
private
Integer
status
;
@ApiModelProperty
(
"图书id"
)
private
String
bookId
;
...
...
com.zrqx.core/src/main/java/com/zrqx/core/model/resource/articlelibrary/ArticleLibraryDiyType.java
浏览文件 @
6a75b7b0
...
...
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import
io.swagger.annotations.ApiModelProperty
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
...
...
@@ -14,9 +15,9 @@ import lombok.Data;
@Table
(
name
=
"res_Article_Library_Diy_Type"
)
public
class
ArticleLibraryDiyType
{
@Id
@GeneratedValue
(
generator
=
"JDBC
"
)
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
,
generator
=
"SELECT REPLACE (UUID(), '-', '')
"
)
@ApiModelProperty
(
"文章与自定义分类关系表id"
)
private
Integer
id
;
private
String
id
;
@ApiModelProperty
(
"文章库id"
)
private
String
alId
;
@ApiModelProperty
(
"自定义分类id"
)
...
...
com.zrqx.core/src/main/java/com/zrqx/core/model/resource/pdffilelibrary/PdfLibraryDiyType.java
浏览文件 @
6a75b7b0
...
...
@@ -15,7 +15,7 @@ import lombok.Data;
public
class
PdfLibraryDiyType
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
,
generator
=
"SELECT REPLACE (UUID(), '-', '')"
)
@ApiModelProperty
(
"
文章i
d,新增时不需要填写"
)
@ApiModelProperty
(
"
pdfI
d,新增时不需要填写"
)
private
String
id
;
@ApiModelProperty
(
"PDF库id"
)
private
String
plId
;
...
...
com.zrqx.core/src/main/java/com/zrqx/core/vo/resource/articlelibrary/ArticleLibraryListVO.java
浏览文件 @
6a75b7b0
...
...
@@ -12,24 +12,10 @@ public class ArticleLibraryListVO {
private
String
name
;
@ApiModelProperty
(
"作者"
)
private
String
author
;
@ApiModelProperty
(
"
来源
"
)
@ApiModelProperty
(
"
所属杂志
"
)
private
String
source
;
@ApiModelProperty
(
"所属图书"
)
private
String
bookName
;
@ApiModelProperty
(
"定价"
)
private
String
price
;
@ApiModelProperty
(
"售价"
)
private
String
realPrice
;
@ApiModelProperty
(
"上传时间"
)
private
String
uploadTime
;
@ApiModelProperty
(
"状态:0
待审核,1已上架,2已下
架"
)
@ApiModelProperty
(
"状态:0
已下架,1已上
架"
)
private
String
status
;
@ApiModelProperty
(
"状态:0待审核,1已上架,2已下架"
)
private
String
status_zh
;
@ApiModelProperty
(
"封面图片"
)
private
String
img
;
@ApiModelProperty
(
"民族 1蒙古族 2侗族 3藏族 4朝鲜族 5土家族 6回族 7满族 8汉族"
)
private
Integer
nationsType
;
@ApiModelProperty
(
"1图书、2医家、3文章、4图片、5视频、6音频、7附件"
)
private
Integer
resourceType
;
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/articlelibrary/ArticleLibraryController.java
浏览文件 @
6a75b7b0
package
com
.
zrqx
.
resource
.
bg
.
controller
.
articlelibrary
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -18,24 +16,17 @@ import org.springframework.web.bind.annotation.RestController;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.enums.ResponseCodeEnum
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
import
com.zrqx.core.exception.BaseException
;
import
com.zrqx.core.exception.BusinessValidateException
;
import
com.zrqx.core.exception.ParameterValidateException
;
import
com.zrqx.core.form.resource.bg.QueryResourceForPoPForm
;
import
com.zrqx.core.form.resource.bg.QueryResourceRelationForm
;
import
com.zrqx.core.form.resource.bg.SaveResourceRelationForm
;
import
com.zrqx.core.form.resource.bg.articlelibrary.BatchUpdateArticleLibraryForm
;
import
com.zrqx.core.form.resource.bg.articlelibrary.QueryArticleLibraryForm
;
import
com.zrqx.core.form.resource.bg.articlelibrary.SaveUpdateArticleLibraryForm
;
import
com.zrqx.core.form.resource.bg.articlelibrary.UpdateArticleImgForm
;
import
com.zrqx.core.form.resource.bg.ebook.UpdateEbookRelationForm
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibrary
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleLibraryDiyType
;
import
com.zrqx.core.model.resource.articlelibrary.ArticleResource
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.util.response.CallBack
;
import
com.zrqx.core.vo.resource.ResourceRelationVo
;
import
com.zrqx.core.vo.resource.articlelibrary.ArticleLibraryListVO
;
import
com.zrqx.core.vo.resource.articlelibrary.ArticleLibraryOneVO
;
import
com.zrqx.resource.bg.service.ResourceRelationService
;
...
...
@@ -59,10 +50,6 @@ public class ArticleLibraryController {
private
ArticleLibraryService
service
;
@Autowired
private
ArticleLibraryDiyTypeService
adrService
;
@Autowired
private
ArticleResourceService
resourceService
;
@Autowired
private
ResourceRelationService
resourceRelationService
;
@ApiOperation
(
value
=
"新增"
,
notes
=
"新增一个"
)
@PostMapping
(
value
=
ResourceRequestPath
.
SAVE
)
public
CallBack
<
Boolean
>
save
(
@RequestBody
SaveUpdateArticleLibraryForm
form
)
{
...
...
@@ -78,7 +65,6 @@ public class ArticleLibraryController {
if
(!
service
.
saveOrUpdate
(
form
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
ArticleLibrary
entity
=
service
.
selectByPrimaryKey
(
form
.
getId
());
return
CallBack
.
success
();
}
...
...
@@ -94,49 +80,6 @@ public class ArticleLibraryController {
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"批量审核"
,
notes
=
"批量审核"
)
@PostMapping
(
value
=
ResourceRequestPath
.
BATCH_UPDATE_STATUS
)
public
CallBack
<
Boolean
>
updateArray
(
@RequestBody
List
<
String
>
ids
)
{
Example
example
=
service
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
ArticleLibrary
entity
=
new
ArticleLibrary
();
entity
.
setStatus
(
LibraryStatusEnum
.
STATUS_1
.
getCode
());
entity
.
setUpdateTime
(
new
Date
());
if
(!
service
.
UpdateByExampleSelective
(
entity
,
example
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"批量修改阅读权限"
,
notes
=
"批量修改阅读权限"
)
@PostMapping
(
value
=
ResourceRequestPath
.
BATCH_UPDATE_READ
)
public
CallBack
<
Boolean
>
updateReadTextPower
(
@RequestBody
BatchUpdateArticleLibraryForm
form
)
{
Example
example
=
service
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
form
.
getIds
());
ArticleLibrary
entity
=
new
ArticleLibrary
();
entity
.
setReadTextPower
(
form
.
getReadTextPower
());
entity
.
setUpdateTime
(
new
Date
());
if
(!
service
.
UpdateByExampleSelective
(
entity
,
example
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"批量修改价格"
,
notes
=
"批量修改价格"
)
@PostMapping
(
value
=
ResourceRequestPath
.
BATCH_UPDATE_PRICE
)
public
CallBack
<
Boolean
>
updatePrice
(
@RequestBody
BatchUpdateArticleLibraryForm
form
)
{
Example
example
=
service
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
form
.
getIds
());
ArticleLibrary
entity
=
new
ArticleLibrary
();
entity
.
setRealPrice
(
form
.
getRealPrice
());
entity
.
setUpdateTime
(
new
Date
());
if
(!
service
.
UpdateByExampleSelective
(
entity
,
example
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"批量修改分类"
,
notes
=
"批量修改分类"
)
@PostMapping
(
value
=
ResourceRequestPath
.
BATCH_UPDATE_DIYTIPE
)
public
CallBack
<
Boolean
>
updateDivType
(
@RequestBody
BatchUpdateArticleLibraryForm
form
)
{
...
...
@@ -163,14 +106,14 @@ public class ArticleLibraryController {
Example
example
=
service
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
form
.
getIds
());
List
<
ArticleLibrary
>
list
=
service
.
selectByExample
(
example
);
for
(
ArticleLibrary
entity
:
list
)
{
/*
for (ArticleLibrary entity : list) {
if (entity.getStatus() == LibraryStatusEnum.STATUS_0.getCode()) {
throw new BusinessValidateException("待审核状态的文章不能直接操作上架状态需通过批量审核操作上架");
}
if (entity.getBookId() != null) {
throw new BusinessValidateException("图书内拆分出来的文章不支持单独上、下架、删除操作");
}
}
}
*/
for
(
ArticleLibrary
entity
:
list
)
{
entity
.
setStatus
(
form
.
getStatus
());
entity
.
setUpdateTime
(
new
Date
());
...
...
@@ -185,9 +128,9 @@ public class ArticleLibraryController {
@PostMapping
(
value
=
ResourceRequestPath
.
DELETE_OID
)
public
CallBack
<
Boolean
>
delete
(
@PathVariable
String
oid
)
{
ArticleLibrary
entity
=
service
.
selectByPrimaryKey
(
oid
);
if
(
entity
.
getBookId
()
!=
null
)
{
/*
if (entity.getBookId() != null) {
throw new BusinessValidateException("图书内拆分出来的文章不支持单独上、下架、删除操作");
}
}
*/
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_1
.
getCode
())
{
throw
new
BusinessValidateException
(
"不能删除已上架的资源"
);
}
...
...
@@ -204,9 +147,9 @@ public class ArticleLibraryController {
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
ArticleLibrary
>
list
=
service
.
selectByExample
(
example
);
for
(
ArticleLibrary
entity
:
list
)
{
if
(
entity
.
getBookId
()
!=
null
){
/*
if(entity.getBookId() != null){
throw new BusinessValidateException("图书内拆分出来的文章不支持单独上、下架、删除操作");
}
}
*/
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_1
.
getCode
())
{
throw
new
BusinessValidateException
(
"不能删除已上架的资源"
);
}
...
...
@@ -220,17 +163,6 @@ public class ArticleLibraryController {
ArticleLibrary
entity
=
service
.
selectByPrimaryKey
(
oid
);
ArticleLibraryOneVO
vo
=
new
ArticleLibraryOneVO
();
BeanUtils
.
copyProperties
(
entity
,
vo
);
if
(
StringUtils
.
isNotBlank
(
entity
.
getAuthorId
())){
vo
.
setAuthorNameAndId
(
entity
.
getAuthor
()
+
","
+
entity
.
getAuthorId
());
}
else
{
vo
.
setAuthorNameAndId
(
entity
.
getAuthor
());
}
if
(
entity
.
getRealPrice
()
!=
null
){
vo
.
setRealPrice
(
entity
.
getRealPrice
().
toString
());
}
if
(
entity
.
getPrice
()
!=
null
){
vo
.
setPrice
(
entity
.
getPrice
().
toString
());
}
//组装自定义分类
Example
example
=
adrService
.
createExample
();
example
.
createCriteria
().
andEqualTo
(
"alId"
,
oid
);
...
...
@@ -244,44 +176,6 @@ public class ArticleLibraryController {
public
CallBack
<
PageInfo
<
ArticleLibraryListVO
>>
page
(
QueryArticleLibraryForm
form
,
PageParam
pageParam
){
return
CallBack
.
success
(
service
.
page
(
form
,
pageParam
));
}
@ApiOperation
(
"相关资源列表"
)
@GetMapping
(
value
=
ResourceRequestPath
.
RELATION_RESOURCE
+
ResourceRequestPath
.
PAGE
)
public
CallBack
<
PageInfo
<
ResourceRelationVo
>>
reousrceRelationPage
(
QueryResourceRelationForm
entity
,
PageParam
pageParam
)
{
if
(
entity
==
null
||
entity
.
getId
()
==
null
)
{
throw
new
ParameterValidateException
(
ResponseCodeEnum
.
MISS_EXCEPTION
.
getCode
(),
"资源id不能为空!"
);
}
List
<
ResourceRelationVo
>
list
=
resourceService
.
queryByIdAndResourceType
(
entity
,
pageParam
);
if
(
list
==
null
||
list
.
size
()
==
0
)
{
return
CallBack
.
success
(
new
PageInfo
<
ResourceRelationVo
>(
list
));
}
return
CallBack
.
success
(
new
PageInfo
<
ResourceRelationVo
>(
resourceRelationService
.
queryRelationList
(
list
)));
}
@ApiOperation
(
value
=
"批量删除关联资源"
,
notes
=
"批量删除"
)
@PostMapping
(
value
=
ResourceRequestPath
.
RES_BATCH_DELETE
)
public
CallBack
<
Boolean
>
deleteByResourceIds
(
@RequestBody
List
<
Integer
>
ids
)
{
if
(
ids
.
size
()
==
0
)
{
throw
new
BaseException
(-
7
,
"没有选中任何数据,请重新选择"
);
}
Example
example
=
resourceService
.
createExample
();
example
.
createCriteria
().
andIn
(
"id"
,
ids
);
List
<
ArticleResource
>
list
=
resourceService
.
selectByExample
(
example
);
for
(
ArticleResource
entity
:
list
)
{
resourceService
.
deleteByPrimaryKey
(
entity
);
}
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"修改排序号"
,
notes
=
"修改排序号"
)
@PostMapping
(
value
=
ResourceRequestPath
.
UPDATE
+
ResourceRequestPath
.
SORT
)
public
CallBack
<
Boolean
>
updateSort
(
@RequestBody
UpdateEbookRelationForm
form
)
{
if
(
form
.
getId
()
==
null
)
{
throw
new
ParameterValidateException
(
"分类不能为空"
);
}
ArticleResource
resource
=
resourceService
.
selectByPrimaryKey
(
form
.
getId
());
resource
.
setSort
(
form
.
getSort
());
resourceService
.
updateByPrimaryKeySelective
(
resource
);
return
CallBack
.
success
();
}
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/ebook/EbookController.java
浏览文件 @
6a75b7b0
...
...
@@ -91,8 +91,6 @@ public class EbookController {
private
ImageLibraryService
ilService
;
@Autowired
private
ImageLibraryDiyTypeRelationService
ildtrService
;
@Autowired
private
RecordService
recordService
;
@ApiOperation
(
"保存电子书"
)
@PostMapping
(
ResourceRequestPath
.
SAVE
)
...
...
@@ -162,65 +160,6 @@ public class EbookController {
return
CallBack
.
success
(
ebookservice
.
page
(
form
,
pageParam
));
}
/*@ApiOperation("相关资源列表")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.PAGE)
public CallBack<PageInfo<ResourceRelationVo>> reousrceRelationPage(QueryResourceRelationForm entity,
PageParam pageParam) {
if (entity == null || entity.getId() == null) {
throw new ParameterValidateException(ResponseCodeEnum.MISS_EXCEPTION.getCode(), "资源id不能为空!");
}
List<ResourceRelationVo> list = resourceService.queryByIdAndResourceType(entity, pageParam);
if (list == null || list.size() == 0) {
return CallBack.success(new PageInfo<ResourceRelationVo>(list));
}
return CallBack.success(new PageInfo<ResourceRelationVo>(resourceRelationService.queryRelationList(list)));
}
@ApiOperation(value = "保存相关资源" , notes ="保存相关资源")
@PostMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.SAVE)
public CallBack<Boolean> saveRelation(@RequestBody SaveResourceRelationForm entity){
if(entity.getId() == null || entity.getResourceIds() == null || entity.getResourceType() == null || entity.getResourceIds().length == 0){
throw new ParameterValidateException(ResponseCodeEnum.MISS_EXCEPTION.getCode(), "必须指定id、被关联的resourceId、资源类型");
}
List<EbookResource> recordList = new ArrayList<EbookResource>();
Arrays.asList(entity.getResourceIds()).forEach(resourceId -> {
EbookResource e = new EbookResource();
e.setEbookId(entity.getId());
e.setResourceId(resourceId);
e.setCreateTime(new Date());
e.setResourceType(entity.getResourceType());
recordList.add(e);
});
return CallBack.success(resourceService.insertList(recordList));
}
@ApiOperation(value = "批量删除关联资源", notes = "批量删除")
@PostMapping(value = ResourceRequestPath.RES_BATCH_DELETE)
public CallBack<Boolean> deleteByResourceIds(@RequestBody List<Integer> ids) {
if (ids.size() == 0) {
throw new BaseException(-7,"没有选中任何数据,请重新选择");
}
Example example = resourceService.createExample();
example.createCriteria().andIn("id", ids);
List<EbookResource> list = resourceService.selectByExample(example);
for (EbookResource entity : list) {
resourceService.deleteByPrimaryKey(entity);
}
return CallBack.success();
}
@ApiOperation(value = "修改排序号", notes = "修改排序号")
@PostMapping(value = ResourceRequestPath.UPDATE + ResourceRequestPath.SORT)
public CallBack<Boolean> updateSort(@RequestBody UpdateEbookRelationForm form) {
if (form.getId() == null) {
throw new ParameterValidateException("分类不能为空");
}
EbookResource resource = resourceService.selectByPrimaryKey(form.getId());
resource.setSort(form.getSort());
resourceService.updateByPrimaryKeySelective(resource);
return CallBack.success();
}*/
/**
* 批量修改
*
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/pdffilelibrary/PdfLibraryController.java
浏览文件 @
6a75b7b0
package
com
.
zrqx
.
resource
.
bg
.
controller
.
pdffilelibrary
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.List
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -15,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
import
com.zrqx.core.exception.BusinessValidateException
;
import
com.zrqx.core.form.resource.bg.pdffilelibrary.BatchUpdatePdfLibraryForm
;
import
com.zrqx.core.form.resource.bg.pdffilelibrary.QueryPdfLibraryForm
;
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/resourcelibrary/ResourceLibraryController.java
浏览文件 @
6a75b7b0
...
...
@@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.zrqx.core.constant.resource.ResourceRequestPath
;
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/mapper/articlelibrary/ArticleLibraryMapper.java
浏览文件 @
6a75b7b0
...
...
@@ -21,30 +21,18 @@ public interface ArticleLibraryMapper extends BaseMapper<ArticleLibrary> {
* @return
*/
@Select
(
"<script>"
+
"select distinct a.id,a.name,a.author,a.source,
a.bookName,a.price,a.realPrice,DATE_FORMAT(a.uploadTime,'%Y-%m-%d') uploadTime,a.status,a.nationsType,a.resourceType
"
+
"select distinct a.id,a.name,a.author,a.source,
DATE_FORMAT(a.uploadTime,'%Y-%m-%d') uploadTime,a.status
"
+
"from res_Article_Library a left join res_Article_Library_Diy_Type ad "
+
"on a.id = ad.alid "
+
"where 1=1 "
+
"<if test='form.resourceType != null' >"
+
"and a.resourceType = #{form.resourceType} "
+
"</if>"
+
"<if test = '"
+
NOTBLANK
+
"(form.diyTypeCode)'>"
+
"and ad.code like concat(#{form.diyTypeCode},'%') "
+
"</if>"
/*+ "<if test='form.diyTypeId != null and form.diyTypeId.size > 0'>"
+ "and ad.dtId in "
+ " <foreach collection=\"form.diyTypeId\" index=\"index\" item=\"id\" open=\"(\" separator=\",\" close=\")\">"
+ "#{id}"
+ "</foreach>"
+ "</if>" */
+
"<if test = '"
+
NOTBLANK
+
"(form.name)'>"
+
"and a.name like concat('%',#{form.name},'%') "
+
"</if>"
+
"<if test = '"
+
NOTBLANK
+
"(form.author)'>"
+
"and a.author like concat('%',#{form.author},'%') "
+
"</if>"
+
"<if test = '"
+
NOTBLANK
+
"(form.source)'>"
+
"and (a.source like concat('%',#{form.source},'%') or a.bookName like concat('%',#{form.source},'%') ) "
+
"<if test = '"
+
NOTBLANK
+
"(form.name)'>"
+
"and (a.author like concat('%',#{form.name},'%') or a.source like concat('%',#{form.name},'%') or a.name like concat('%',#{form.name},'%') ) "
+
"</if>"
+
"<if test='form.status != null'>"
+
"and a.status = #{form.status}"
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/articlelibrary/ArticleLibrarySerivceImpl.java
浏览文件 @
6a75b7b0
...
...
@@ -55,35 +55,17 @@ public class ArticleLibrarySerivceImpl extends BaseServiceImpl<ArticleLibrary,St
public
boolean
saveOrUpdate
(
SaveUpdateArticleLibraryForm
form
)
{
ArticleLibrary
entity
=
new
ArticleLibrary
();
BeanUtils
.
copyProperties
(
form
,
entity
);
if
(
StringUtils
.
isNotBlank
(
form
.
getAuthorNameAndId
())){
String
[]
authorNameAndId
=
form
.
getAuthorNameAndId
().
split
(
","
);
form
.
setAuthor
(
authorNameAndId
[
0
]);
if
(
authorNameAndId
.
length
>
1
){
form
.
setAuthorId
(
authorNameAndId
[
1
]);
}
}
if
(
PriceOptionEnum
.
STATUS_0
.
getCode
()
==
form
.
getPriceOption
()){
entity
.
setRealPrice
(
new
BigDecimal
(
0
));
}
if
(
entity
.
getId
()
==
null
){
//添加
entity
.
setStatus
(
LibraryStatusEnum
.
STATUS_
0
.
getCode
());
entity
.
setStatus
(
LibraryStatusEnum
.
STATUS_
1
.
getCode
());
entity
.
setUploadTime
(
new
Date
());
entity
.
setBrowseNum
(
50
);
//浏览数量
entity
.
setReadTextPower
(
1
);
entity
.
setSalesNum
(
0
);
entity
.
setGoodsType
(
GoodsTypeEnum
.
ARTICLE
.
getCode
());
entity
.
setResourceType
(
AllResourceTypeEnum
.
ARTICLE
.
getCode
());
mapper
.
insert
(
entity
);
}
else
{
//修改
entity
.
setUpdateTime
(
new
Date
());
mapper
.
updateByPrimaryKeySelective
(
entity
);
if
(
form
.
getPrice
()
==
null
){
ArticleLibrary
a
=
mapper
.
selectByPrimaryKey
(
entity
.
getId
());
a
.
setPrice
(
form
.
getPrice
());
mapper
.
updateByPrimaryKey
(
a
);
}
//删除当前对象与自定义分类的关系
ArticleLibraryDiyType
old
=
new
ArticleLibraryDiyType
();
old
.
setAlId
(
entity
.
getId
());
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论