Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
S
scsm
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
scsm
Commits
d8361fbd
提交
d8361fbd
authored
12月 08, 2020
作者:
renjiancai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
111c24b8
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
17 行增加
和
123 行删除
+17
-123
AnnexLibraryController.java
...ce/bg/controller/annexlibrary/AnnexLibraryController.java
+8
-38
AnnexLibraryMapper.java
...x/resource/bg/mapper/annexlibrary/AnnexLibraryMapper.java
+4
-23
AnnexLibrarySerivceImpl.java
...urce/bg/service/annexlibrary/AnnexLibrarySerivceImpl.java
+5
-62
没有找到文件。
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/controller/annexlibrary/AnnexLibraryController.java
浏览文件 @
d8361fbd
...
...
@@ -5,7 +5,6 @@ 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,12 +17,10 @@ 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.QueryResourceForPoPForm
;
import
com.zrqx.core.form.resource.bg.annexlibrary.BatchUpdateAnnexLibraryForm
;
import
com.zrqx.core.form.resource.bg.annexlibrary.QueryAnnexLibraryForm
;
import
com.zrqx.core.form.resource.bg.annexlibrary.SaveAnnexLibraryForm
;
import
com.zrqx.core.form.resource.bg.annexlibrary.SaveUpdateAnnexLibraryForm
;
import
com.zrqx.core.form.resource.bg.videolibrary.BatchUpdateVideoLibraryForm
;
import
com.zrqx.core.model.resource.annexlibrary.AnnexLibrary
;
import
com.zrqx.core.model.resource.annexlibrary.AnnexLibraryDiyType
;
import
com.zrqx.core.util.page.PageInfo
;
...
...
@@ -31,10 +28,8 @@ import com.zrqx.core.util.page.PageParam;
import
com.zrqx.core.util.response.CallBack
;
import
com.zrqx.core.vo.resource.annexlibrary.AnnexLibraryListVO
;
import
com.zrqx.core.vo.resource.annexlibrary.AnnexLibraryOneVO
;
import
com.zrqx.resource.bg.service.ResourceRelationService
;
import
com.zrqx.resource.bg.service.annexlibrary.AnnexLibraryDiyTypeService
;
import
com.zrqx.resource.bg.service.annexlibrary.AnnexLibraryService
;
import
com.zrqx.resource.bg.service.recommend.RecommendResourceService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -45,20 +40,13 @@ import tk.mybatis.mapper.entity.Example;
*/
@RestController
@RequestMapping
(
ResourceRequestPath
.
BG
+
ResourceRequestPath
.
ANNEX_LIBRARY
)
@Api
(
description
=
"资源管理-
附
件库"
)
@Api
(
description
=
"资源管理-
课
件库"
)
public
class
AnnexLibraryController
{
@Autowired
private
AnnexLibraryService
service
;
@Autowired
private
AnnexLibraryDiyTypeService
vdrService
;
//@Autowired
//private AnnexResourceService resourceService;
@Autowired
private
ResourceRelationService
resourceRelationService
;
/** 推荐位内容*/
@Autowired
private
RecommendResourceService
recommendResourceService
;
@ApiOperation
(
value
=
"新增"
,
notes
=
"新增一个"
)
...
...
@@ -85,7 +73,6 @@ public class AnnexLibraryController {
if
(!
service
.
saveOrUpdate
(
form
)){
throw
new
BusinessValidateException
(
"操作失败"
);
}
AnnexLibrary
entity
=
service
.
selectByPrimaryKey
(
form
.
getId
());
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"批量修改价格"
,
notes
=
"批量修改价格"
)
...
...
@@ -116,13 +103,13 @@ public class AnnexLibraryController {
ls
.
forEach
(
l
->
l
.
setAnnexId
(
alId
));
list
.
addAll
(
ls
);
});
if
(!
vdrService
.
insertList
(
list
))
{
if
(!
vdrService
.
insert
Uuid
List
(
list
))
{
throw
new
BusinessValidateException
(
"操作失败"
);
}
return
CallBack
.
success
();
}
@ApiOperation
(
value
=
"批量审核"
,
notes
=
"批量审核"
)
/*
@ApiOperation(value = "批量审核", notes = "批量审核")
@PostMapping(value = ResourceRequestPath.BATCH_UPDATE_STATUS)
public CallBack<Boolean> updateArray(@RequestBody List<String> ids) {
Example example = service.createExample();
...
...
@@ -141,12 +128,6 @@ public class AnnexLibraryController {
public CallBack<Boolean> updateShowState(@RequestBody BatchUpdateAnnexLibraryForm form){
Example example = service.createExample();
example.createCriteria().andIn("id", form.getIds());
List
<
AnnexLibrary
>
list
=
service
.
selectByExample
(
example
);
for
(
AnnexLibrary
entity
:
list
)
{
if
(
entity
.
getStatus
()
==
LibraryStatusEnum
.
STATUS_0
.
getCode
()){
throw
new
BusinessValidateException
(
"待审核状态的文章不能直接操作上架状态需通过批量审核操作上架"
);
}
}
AnnexLibrary entity = new AnnexLibrary();
entity.setStatus(form.getStatus());
entity.setUpdateTime(new Date());
...
...
@@ -154,7 +135,7 @@ public class AnnexLibraryController {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
}
*/
...
...
@@ -181,17 +162,6 @@ public class AnnexLibraryController {
AnnexLibrary
entity
=
service
.
selectByPrimaryKey
(
oid
);
AnnexLibraryOneVO
vo
=
new
AnnexLibraryOneVO
();
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
=
vdrService
.
createExample
();
example
.
createCriteria
().
andEqualTo
(
"annexId"
,
oid
);
List
<
AnnexLibraryDiyType
>
list
=
vdrService
.
selectByExample
(
example
);
...
...
@@ -205,12 +175,12 @@ public class AnnexLibraryController {
public
CallBack
<
PageInfo
<
AnnexLibraryListVO
>>
page
(
QueryAnnexLibraryForm
form
,
PageParam
pageParam
){
return
CallBack
.
success
(
service
.
page
(
form
,
pageParam
));
}
@ApiOperation
(
value
=
"选择弹窗中的列表"
,
notes
=
"查询选择弹窗中的列表"
)
/*
@ApiOperation(value = "选择弹窗中的列表" , notes ="查询选择弹窗中的列表")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.POPPAGE)
public CallBack<PageInfo<AnnexLibraryListVO>> page(QueryResourceForPoPForm form, PageParam pageParam){
return CallBack.success(service.pageByTitleAndDiyType(form, pageParam));
}
/*
@ApiOperation("相关资源列表")
@ApiOperation("相关资源列表")
@GetMapping(value = ResourceRequestPath.RELATION_RESOURCE + ResourceRequestPath.PAGE)
public CallBack<PageInfo<ResourceRelationVo>> reousrceRelationPage(QueryResourceRelationForm entity,
PageParam pageParam) {
...
...
@@ -265,7 +235,7 @@ public class AnnexLibraryController {
resource.setSort(form.getSort());
resourceService.updateByPrimaryKeySelective(resource);
return CallBack.success();
}
*/
}
@ApiOperation(value = "批量修改阅读权限", notes = "批量修改阅读权限")
@PostMapping(value = ResourceRequestPath.BATCH_UPDATE_READ)
...
...
@@ -279,5 +249,5 @@ public class AnnexLibraryController {
throw new BusinessValidateException("操作失败");
}
return CallBack.success();
}
}
*/
}
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/mapper/annexlibrary/AnnexLibraryMapper.java
浏览文件 @
d8361fbd
...
...
@@ -15,33 +15,14 @@ import com.zrqx.core.vo.resource.annexlibrary.AnnexLibraryListVO;
*/
public
interface
AnnexLibraryMapper
extends
BaseMapper
<
AnnexLibrary
>
{
@Select
(
"<script>"
+
"select a.id,a.name,a.source,a.
bookName,a.realprice,a.timeLength,a.size,a.uploadTime,a.status
"
+
"select a.id,a.name,a.source,a.
uploadTime
"
+
"from res_annex_library a left join res_annex_library_Diy_Type ad "
+
"on a.id = ad.annexid "
+
"where 1=1 "
+
"on a.id = ad.annexid where 1=1 "
+
"<if test='"
+
NOTBLANK
+
"(form.diyTypeCode)'>"
+
"and ad.code like concat(#{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.bookName)'>"
+
"and a.bookName like concat('%',#{form.bookName},'%') "
+
"</if>"
+
"<if test='form.status != null'>"
+
"and a.status = #{form.status} "
+
"</if>"
+
"<if test = '"
+
NOTBLANK
+
"(form.beginTime)'>"
+
"and a.uploadTime >= concat(#{form.beginTime}, ' 00:00:00' )"
+
"</if>"
+
"<if test = '"
+
NOTBLANK
+
"(form.endTime)'>"
+
"and a.uploadTime <= concat(#{form.endTime}, ' 23:59:59')"
+
" and (a.name like concat('%',#{form.name},'%') or a.source like concat('%',#{form.name},'%')"
+
"</if>"
+
" order by a.uploadTime desc "
+
"</script>"
)
...
...
com.zrqx.resource/src/main/java/com/zrqx/resource/bg/service/annexlibrary/AnnexLibrarySerivceImpl.java
浏览文件 @
d8361fbd
package
com
.
zrqx
.
resource
.
bg
.
service
.
annexlibrary
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -12,7 +10,6 @@ import org.springframework.stereotype.Service;
import
com.zrqx.core.enums.AllResourceTypeEnum
;
import
com.zrqx.core.enums.ResponseCodeEnum
;
import
com.zrqx.core.enums.resource.LibraryStatusEnum
;
import
com.zrqx.core.enums.resource.PriceOptionEnum
;
import
com.zrqx.core.exception.BusinessValidateException
;
import
com.zrqx.core.exception.ParameterValidateException
;
import
com.zrqx.core.form.resource.bg.QueryResourceForPoPForm
;
...
...
@@ -22,26 +19,16 @@ import com.zrqx.core.form.resource.bg.annexlibrary.SaveUpdateAnnexLibraryForm;
import
com.zrqx.core.mapper.BaseMapper
;
import
com.zrqx.core.model.resource.annexlibrary.AnnexLibrary
;
import
com.zrqx.core.model.resource.annexlibrary.AnnexLibraryDiyType
;
import
com.zrqx.core.model.resource.annexlibrary.AnnexLibraryLabelContentDiyType
;
import
com.zrqx.core.model.resource.membercollection.MemberCollection
;
import
com.zrqx.core.model.resource.record.Record
;
import
com.zrqx.core.model.resource.resourcerelation.ResourceRelation
;
import
com.zrqx.core.model.resource.shoppingcart.ShoppingCart
;
import
com.zrqx.core.service.BaseServiceImpl
;
import
com.zrqx.core.util.bean.BeanUtils
;
import
com.zrqx.core.util.page.PageInfo
;
import
com.zrqx.core.util.page.PageParam
;
import
com.zrqx.core.vo.resource.annexlibrary.AnnexLibraryListVO
;
import
com.zrqx.resource.bg.client.order.OrderClient
;
import
com.zrqx.resource.bg.mapper.annexlibrary.AnnexLibraryDiyTypeMapper
;
import
com.zrqx.resource.bg.mapper.annexlibrary.AnnexLibraryMapper
;
import
com.zrqx.resource.bg.mapper.annexlibrary.AnnexResourceMapper
;
import
com.zrqx.resource.bg.mapper.authorLibrary.ResourceRelationMapper
;
import
com.zrqx.resource.bg.mapper.marketing.PromotionContentMapper
;
import
com.zrqx.resource.bg.mapper.membercollection.MemberCollectionMapper
;
import
com.zrqx.resource.bg.mapper.recommend.RecommendResourceMapper
;
import
com.zrqx.resource.bg.mapper.record.RecordMapper
;
import
com.zrqx.resource.bg.mapper.shoppingcart.ShoppingCartMapper
;
import
tk.mybatis.mapper.entity.Example
;
...
...
@@ -56,20 +43,6 @@ public class AnnexLibrarySerivceImpl extends BaseServiceImpl<AnnexLibrary,String
@Autowired
private
AnnexLibraryDiyTypeMapper
vdrMapper
;
@Autowired
private
OrderClient
orderClient
;
@Autowired
private
MemberCollectionMapper
memberCollectionMapper
;
@Autowired
private
RecordMapper
recordMapper
;
@Autowired
private
ShoppingCartMapper
shoppingCartMapper
;
@Autowired
private
RecommendResourceMapper
recommendResourceMapper
;
@Autowired
private
PromotionContentMapper
promotionContentMapper
;
@Autowired
private
AnnexResourceMapper
annexResourceMapper
;
@Autowired
private
ResourceRelationMapper
resourceRelationMapper
;
@Override
...
...
@@ -86,36 +59,19 @@ public class AnnexLibrarySerivceImpl extends BaseServiceImpl<AnnexLibrary,String
@Override
public
boolean
saveOrUpdate
(
SaveUpdateAnnexLibraryForm
form
)
{
AnnexLibrary
entity
=
new
AnnexLibrary
();
if
(
StringUtils
.
isNotBlank
(
form
.
getAuthorNameAndId
())){
String
[]
authorNameAndId
=
form
.
getAuthorNameAndId
().
split
(
","
);
form
.
setAuthor
(
authorNameAndId
[
0
]);
if
(
authorNameAndId
.
length
>
1
){
form
.
setAuthorId
(
authorNameAndId
[
1
]);
}
}
BeanUtils
.
copyProperties
(
form
,
entity
);
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
.
setResourceType
(
AllResourceTypeEnum
.
ANNEX
.
getCode
());
entity
.
setBrowseNum
(
50
);
entity
.
setReadTextPower
(
1
);
entity
.
setDownloadNum
(
50
);
entity
.
setBrowseNum
(
0
);
entity
.
setSalesNum
(
0
);
mapper
.
insert
(
entity
);
}
else
{
//修改
entity
.
setUpdateTime
(
new
Date
());
mapper
.
updateByPrimaryKeySelective
(
entity
);
if
(
form
.
getPrice
()
==
null
){
AnnexLibrary
a
=
mapper
.
selectByPrimaryKey
(
entity
.
getId
());
a
.
setPrice
(
form
.
getPrice
());
mapper
.
updateByPrimaryKey
(
a
);
}
//删除当前对象与自定义分类的关系
AnnexLibraryDiyType
old
=
new
AnnexLibraryDiyType
();
old
.
setAnnexId
(
entity
.
getId
());
...
...
@@ -125,7 +81,7 @@ public class AnnexLibrarySerivceImpl extends BaseServiceImpl<AnnexLibrary,String
if
(
form
.
getDiyType
()
!=
null
&&
form
.
getDiyType
().
size
()
>
0
){
List
<
AnnexLibraryDiyType
>
list
=
form
.
getDiyType
();
list
.
forEach
(
li
->
li
.
setAnnexId
(
entity
.
getId
()));
vdrMapper
.
insertList
(
list
);
vdrMapper
.
insert
Uuid
List
(
list
);
}
return
true
;
}
...
...
@@ -150,13 +106,9 @@ public class AnnexLibrarySerivceImpl extends BaseServiceImpl<AnnexLibrary,String
obj
.
setSize
(
form
.
getSize
().
get
(
i
));
obj
.
setFormats
(
form
.
getFormats
().
get
(
i
));
obj
.
setUploadTime
(
new
Date
());
obj
.
setStatus
(
LibraryStatusEnum
.
STATUS_
0
.
getCode
());
obj
.
setStatus
(
LibraryStatusEnum
.
STATUS_
1
.
getCode
());
obj
.
setResourceType
(
AllResourceTypeEnum
.
ANNEX
.
getCode
());
obj
.
setBrowseNum
(
50
);
obj
.
setReadTextPower
(
1
);
obj
.
setDownloadNum
(
50
);
obj
.
setSalesNum
(
0
);
obj
.
setPriceOption
(
1
);
obj
.
setBrowseNum
(
0
);
obj
.
setAnnexName
(
form
.
getNames
().
get
(
i
));
mapper
.
insert
(
obj
);
if
(
form
.
getDiyType
()
!=
null
){
...
...
@@ -198,10 +150,6 @@ public class AnnexLibrarySerivceImpl extends BaseServiceImpl<AnnexLibrary,String
example
=
new
Example
(
ResourceRelation
.
class
);
example
.
createCriteria
().
andIn
(
"objectId"
,
ids
).
orIn
(
"resourceId"
,
ids
);
resourceRelationMapper
.
deleteByExample
(
example
);
//删除资源收藏相关信息
example
=
new
Example
(
MemberCollection
.
class
);
example
.
createCriteria
().
andIn
(
"objectId"
,
ids
);
memberCollectionMapper
.
deleteByExample
(
example
);
return
true
;
}
/**
...
...
@@ -235,11 +183,6 @@ public class AnnexLibrarySerivceImpl extends BaseServiceImpl<AnnexLibrary,String
}
startPage
(
pageParam
);
List
<
AnnexLibraryListVO
>
list
=
mapper
.
queryByTileAndDiyType
(
form
);
if
(!
list
.
isEmpty
()){
for
(
AnnexLibraryListVO
ebookListVO
:
list
){
ebookListVO
.
setStatus_zh
(
LibraryStatusEnum
.
getName
(
Integer
.
parseInt
(
ebookListVO
.
getStatus
())));
}
}
return
new
PageInfo
<
AnnexLibraryListVO
>(
list
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论