Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
midjourney-proxy
Overview
Overview
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
徐少华
midjourney-proxy
Commits
0f5779b1
Commit
0f5779b1
authored
Sep 13, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1003565] 小程序内答案及应用作品资源收藏功能
parent
a248a150
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
684 additions
and
15 deletions
+684
-15
ServeCollectBiz.java
...main/java/com/pcloud/book/applet/biz/ServeCollectBiz.java
+79
-0
AppletNewsBizImpl.java
...va/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
+5
-0
ServeCollectBizImpl.java
.../com/pcloud/book/applet/biz/impl/ServeCollectBizImpl.java
+0
-0
ServeCollectDao.java
...main/java/com/pcloud/book/applet/dao/ServeCollectDao.java
+24
-0
ServeCollectDaoImpl.java
.../com/pcloud/book/applet/dao/impl/ServeCollectDaoImpl.java
+39
-0
ServeCollect.java
...main/java/com/pcloud/book/applet/entity/ServeCollect.java
+68
-0
CollectionTypeEnum.java
...java/com/pcloud/book/applet/enums/CollectionTypeEnum.java
+14
-0
ServeCollectFacade.java
...ava/com/pcloud/book/applet/facade/ServeCollectFacade.java
+113
-0
BookGroupBiz.java
...src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
+2
-1
BookGroupBizImpl.java
...java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
+45
-1
BookServeDTO.java
...src/main/java/com/pcloud/book/group/dto/BookServeDTO.java
+2
-0
BookGroupFacade.java
...in/java/com/pcloud/book/group/facade/BookGroupFacade.java
+1
-0
BookGroupFacadeImpl.java
...om/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
+3
-1
RegionMapMapper.java
...n/java/com/pcloud/book/record/mapper/RegionMapMapper.java
+2
-0
RightsSettingBiz.java
...a/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
+1
-2
RightsSettingBizImpl.java
...oud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
+81
-7
RightsNowItem.java
...a/com/pcloud/book/rightsSetting/entity/RightsNowItem.java
+2
-1
RightsSettingFacede.java
...pcloud/book/rightsSetting/facade/RightsSettingFacede.java
+2
-2
ServeCollect.Mapper.xml
.../src/main/resources/mapper/applet/ServeCollect.Mapper.xml
+201
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/ServeCollectBiz.java
0 → 100644
View file @
0f5779b1
package
com
.
pcloud
.
book
.
applet
.
biz
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* (ServeCollect)表服务接口
*
* @author makejava
* @since 2020-09-10 10:44:31
*/
public
interface
ServeCollectBiz
{
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
ServeCollect
getById
(
Long
id
);
/**
* 分页查询
*/
PageBeanNew
getList
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
);
/**
* 新增数据
*
* @param serveCollect 实例对象
* @return 主键
*/
Long
insert
(
ServeCollect
serveCollect
);
/**
* 修改数据
*
* @param serveCollect 实例对象
*/
void
update
(
ServeCollect
serveCollect
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 是否成功
*/
void
deleteById
(
Long
id
);
/**
* 批量取消关注
*/
void
cancelCollect
(
List
<
Long
>
ids
);
/**
* 删除无效的资讯
* @param newArrayList
*/
void
deleteInvalidNews
(
List
<
Long
>
newArrayList
);
/**
* 查询是否是否存在
* @param serveCollects
* @return
*/
List
<
ServeCollect
>
getList4RightsSetting
(
List
<
ServeCollect
>
serveCollects
);
/**
* 获取所有的收藏id
* @param wechatUserId
* @return
*/
List
<
Long
>
getAllCollect
(
Long
wechatUserId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletNewsBizImpl.java
View file @
0f5779b1
...
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
...
@@ -6,6 +6,7 @@ import com.google.common.collect.Lists;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.ServeCollectBiz
;
import
com.pcloud.book.applet.contants.AppletConstants
;
import
com.pcloud.book.applet.contants.AppletConstants
;
import
com.pcloud.book.applet.dao.AppletBusinessCardDao
;
import
com.pcloud.book.applet.dao.AppletBusinessCardDao
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
...
@@ -127,6 +128,8 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -127,6 +128,8 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
private
BookBrowseRecordBiz
bookBrowseRecordBiz
;
private
BookBrowseRecordBiz
bookBrowseRecordBiz
;
@Autowired
@Autowired
private
RegionMapMapper
regionMapMapper
;
private
RegionMapMapper
regionMapMapper
;
@Autowired
private
ServeCollectBiz
serveCollectBiz
;
@Override
@Override
public
void
deleteCategoryById
(
Long
id
)
{
public
void
deleteCategoryById
(
Long
id
)
{
...
@@ -327,6 +330,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -327,6 +330,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
appletNewsDao
.
deleteByNews
(
Lists
.
newArrayList
(
id
));
appletNewsDao
.
deleteByNews
(
Lists
.
newArrayList
(
id
));
//同时删除配置的资讯 1 删除即享权益 2 删除删除周或长期
//同时删除配置的资讯 1 删除即享权益 2 删除删除周或长期
rightsSettingBiz
.
deleteInvalidNews
(
Lists
.
newArrayList
(
id
));
rightsSettingBiz
.
deleteInvalidNews
(
Lists
.
newArrayList
(
id
));
serveCollectBiz
.
deleteInvalidNews
(
Lists
.
newArrayList
(
id
));
this
.
updateSource
(
beforeNews
.
getSource
(),
null
,
beforeNews
.
getAgentId
());
this
.
updateSource
(
beforeNews
.
getSource
(),
null
,
beforeNews
.
getAgentId
());
JedisClusterUtils
.
del
(
AppletConstants
.
HOME_NEWS_LIST
);
JedisClusterUtils
.
del
(
AppletConstants
.
HOME_NEWS_LIST
);
}
}
...
@@ -837,6 +841,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
...
@@ -837,6 +841,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
appletNewsDao
.
deleteByNews
(
appletNewsIds
);
appletNewsDao
.
deleteByNews
(
appletNewsIds
);
//资讯下架 删除与权益的关联关系
//资讯下架 删除与权益的关联关系
rightsSettingBiz
.
deleteInvalidNews
(
appletNewsIds
);
rightsSettingBiz
.
deleteInvalidNews
(
appletNewsIds
);
serveCollectBiz
.
deleteInvalidNews
(
Lists
.
newArrayList
(
appletNewsIds
));
JedisClusterUtils
.
del
(
AppletConstants
.
HOME_NEWS_LIST
);
JedisClusterUtils
.
del
(
AppletConstants
.
HOME_NEWS_LIST
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/ServeCollectBizImpl.java
0 → 100644
View file @
0f5779b1
This diff is collapsed.
Click to expand it.
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/ServeCollectDao.java
0 → 100644
View file @
0f5779b1
package
com
.
pcloud
.
book
.
applet
.
dao
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* (ServeCollect)表数据库访问层
*
* @author makejava
* @since 2020-09-10 10:44:31
*/
public
interface
ServeCollectDao
extends
BaseDao
<
ServeCollect
>
{
void
cancelCollect
(
List
<
Long
>
ids
);
void
deleteInvalidNews
(
List
<
Long
>
newsIds
);
List
<
ServeCollect
>
getList4RightsSetting
(
List
<
ServeCollect
>
serveCollects
);
List
<
Long
>
getAllCollect
(
Long
wechatUserId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/ServeCollectDaoImpl.java
0 → 100644
View file @
0f5779b1
package
com
.
pcloud
.
book
.
applet
.
dao
.
impl
;
import
com.pcloud.book.applet.dao.ServeCollectDao
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* (ServeCollect)表数据库访问层
*
* @author makejava
* @since 2020-09-10 10:44:31
*/
@Repository
(
"serveCollectDaoImpl"
)
public
class
ServeCollectDaoImpl
extends
BaseDaoImpl
<
ServeCollect
>
implements
ServeCollectDao
{
@Override
public
void
cancelCollect
(
List
<
Long
>
ids
)
{
getSessionTemplate
().
update
(
getStatement
(
"cancelCollect"
),
ids
);
}
@Override
public
void
deleteInvalidNews
(
List
<
Long
>
newsIds
)
{
getSessionTemplate
().
update
(
getStatement
(
"deleteInvalidNews"
),
newsIds
);
}
@Override
public
List
<
ServeCollect
>
getList4RightsSetting
(
List
<
ServeCollect
>
serveCollects
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getList4RightsSetting"
),
serveCollects
);
}
@Override
public
List
<
Long
>
getAllCollect
(
Long
wechatUserId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAllCollect"
),
wechatUserId
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/ServeCollect.java
0 → 100644
View file @
0f5779b1
package
com
.
pcloud
.
book
.
applet
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.applet.dto.AppletAppOrProductDTO
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.elasticsearch.search.aggregations.metrics.geobounds.InternalGeoBounds
;
import
java.util.Date
;
/**
* (ServeCollect)实体类
*
* @author makejava
* @since 2020-09-10 17:38:20
*/
@Data
public
class
ServeCollect
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
-
73442666265944368L
;
private
Long
id
;
@ApiModelProperty
(
"读者id"
)
private
Long
wechatUserId
;
@ApiModelProperty
(
"应用id 如答案"
)
private
Long
serveId
;
@ApiModelProperty
(
"服务名称"
)
private
String
serveName
;
@ApiModelProperty
(
"应用类型 1 答案"
)
private
Integer
serveType
;
private
Integer
serveCode
;
private
String
serveTypeCode
;
private
String
linkUrl
;
private
String
picUrl
;
@ApiModelProperty
(
"是否删除 1 删除 0 未删除"
)
private
Integer
isDelete
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
createTime
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
updateTime
;
@ApiModelProperty
(
"收藏日期"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
collectDay
;
@ApiModelProperty
(
"资源是否删除"
)
private
Integer
sourceDelete
;
private
AppletAppOrProductDTO
appletAppOrProductDTO
;
private
AppletNewsDTO
appletNewsDTO
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/enums/CollectionTypeEnum.java
0 → 100644
View file @
0f5779b1
package
com
.
pcloud
.
book
.
applet
.
enums
;
public
enum
CollectionTypeEnum
{
//答案
ANSWER
(
1
);
public
Integer
value
;
CollectionTypeEnum
(
Integer
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/ServeCollectFacade.java
0 → 100644
View file @
0f5779b1
package
com
.
pcloud
.
book
.
applet
.
facade
;
import
com.pcloud.book.applet.biz.ServeCollectBiz
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.SessionUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.CookieValue
;
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.RequestHeader
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* (ServeCollect)表控制层
*
* @author makejava
* @since 2020-09-10 10:44:31
*/
@RestController
(
"serveCollectFacade"
)
@RequestMapping
(
"serveCollect"
)
public
class
ServeCollectFacade
{
@Autowired
private
ServeCollectBiz
serveCollectBiz
;
@ApiOperation
(
"通过主键查询单条数据"
)
@GetMapping
(
"getById"
)
public
ResponseDto
<?>
getById
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
serveCollectBiz
.
getById
(
id
));
}
@ApiOperation
(
"分页查询"
)
@GetMapping
(
"getList"
)
public
ResponseDto
<?>
getList
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"currentPage"
,
defaultValue
=
"0"
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
defaultValue
=
"10"
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
serveCollectBiz
.
getList
(
wechatUserId
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"新增"
)
@PostMapping
(
"insert"
)
public
ResponseDto
<?>
insert
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
ServeCollect
serveCollect
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
serveCollectBiz
.
insert
(
serveCollect
));
}
@ApiOperation
(
"收藏"
)
@PostMapping
(
"collect"
)
public
ResponseDto
<?>
collect
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
ServeCollect
serveCollect
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
serveCollect
.
setWechatUserId
(
wechatUserId
);
return
new
ResponseDto
<>(
serveCollectBiz
.
insert
(
serveCollect
));
}
@ApiOperation
(
"更新"
)
@PostMapping
(
"update"
)
public
ResponseDto
<?>
update
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
ServeCollect
serveCollect
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
serveCollectBiz
.
update
(
serveCollect
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除"
)
@GetMapping
(
"deleteById"
)
public
ResponseDto
<?>
deleteById
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
Long
id
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
id
)
{
throw
BookBizException
.
PARAM_DELETION
;
}
serveCollectBiz
.
deleteById
(
id
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"取消收藏"
)
@PostMapping
(
"cancelCollect"
)
public
ResponseDto
<?>
cancelCollect
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestBody
List
<
Long
>
ids
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
ListUtils
.
isEmpty
(
ids
))
{
throw
BookBizException
.
PARAM_DELETION
;
}
serveCollectBiz
.
cancelCollect
(
ids
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"删除"
)
@GetMapping
(
"getAllCollect"
)
public
ResponseDto
<?>
getAllCollect
(
@CookieValue
(
"userInfo"
)
String
userInfo
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
List
<
Long
>
ids
=
serveCollectBiz
.
getAllCollect
(
wechatUserId
);
return
new
ResponseDto
<>(
ListUtils
.
isEmpty
(
ids
)
?
new
ArrayList
<>()
:
ids
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/BookGroupBiz.java
View file @
0f5779b1
...
@@ -825,9 +825,10 @@ public interface BookGroupBiz {
...
@@ -825,9 +825,10 @@ public interface BookGroupBiz {
* @param adviserId
* @param adviserId
* @param bookId
* @param bookId
* @param channelId
* @param channelId
* @param wechatUserId
* @return
* @return
*/
*/
PageBeanNew
<
BookServeDTO
>
getBookAndBookGroupServeList
(
Long
adviserId
,
Long
bookId
,
Long
channelId
);
PageBeanNew
<
BookServeDTO
>
getBookAndBookGroupServeList
(
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Long
wechatUserId
);
void
removeCanNotBuy
(
List
<
BookServeDTO
>
list
);
void
removeCanNotBuy
(
List
<
BookServeDTO
>
list
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/BookGroupBizImpl.java
View file @
0f5779b1
...
@@ -12,9 +12,11 @@ import com.pcloud.audioapp.audioLesson.service.AudioLessonService;
...
@@ -12,9 +12,11 @@ import com.pcloud.audioapp.audioLesson.service.AudioLessonService;
import
com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz
;
import
com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz
;
import
com.pcloud.book.applet.biz.AppletRecordBiz
;
import
com.pcloud.book.applet.biz.AppletRecordBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.ServeCollectBiz
;
import
com.pcloud.book.applet.entity.AppletGroupSearchRecord
;
import
com.pcloud.book.applet.entity.AppletGroupSearchRecord
;
import
com.pcloud.book.applet.entity.AppletRecord
;
import
com.pcloud.book.applet.entity.AppletRecord
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.biz.BookBiz
;
...
@@ -177,9 +179,11 @@ import com.pcloud.book.record.entity.BookBrowseRecord;
...
@@ -177,9 +179,11 @@ import com.pcloud.book.record.entity.BookBrowseRecord;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.constants.RightsSettingConstant
;
import
com.pcloud.book.rightsSetting.constants.RightsSettingConstant
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.book.skill.entity.PcloudGroupActivity
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.ThreadPoolUtils
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.book.util.properties.BookProps
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.base.constants.ChannelConstants
;
import
com.pcloud.channelcenter.base.constants.ChannelEnum
;
import
com.pcloud.channelcenter.base.constants.ChannelEnum
;
...
@@ -441,6 +445,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -441,6 +445,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
private
AppletRecordBiz
appletRecordBiz
;
private
AppletRecordBiz
appletRecordBiz
;
@Autowired
@Autowired
private
ChannelConsr
channelConsr
;
private
ChannelConsr
channelConsr
;
@Autowired
private
ServeCollectBiz
serveCollectBiz
;
private
static
final
ThreadPoolExecutor
PLATFORM_STATISTICS_EXPORT_THREAD
=
new
ThreadPoolExecutor
(
2
,
2
,
private
static
final
ThreadPoolExecutor
PLATFORM_STATISTICS_EXPORT_THREAD
=
new
ThreadPoolExecutor
(
2
,
2
,
0
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(),
0
,
TimeUnit
.
SECONDS
,
new
LinkedBlockingQueue
<>(),
...
@@ -4977,7 +4983,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -4977,7 +4983,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
}
@Override
@Override
public
PageBeanNew
<
BookServeDTO
>
getBookAndBookGroupServeList
(
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
public
PageBeanNew
<
BookServeDTO
>
getBookAndBookGroupServeList
(
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Long
wechatUserId
)
{
//社群书和现代纸书下资源
//社群书和现代纸书下资源
List
<
BookServeDTO
>
serveDTOList
=
getBookAndBookGroupServeIds
(
adviserId
,
bookId
,
channelId
);
List
<
BookServeDTO
>
serveDTOList
=
getBookAndBookGroupServeIds
(
adviserId
,
bookId
,
channelId
);
if
(
ListUtils
.
isEmpty
(
serveDTOList
))
{
if
(
ListUtils
.
isEmpty
(
serveDTOList
))
{
...
@@ -4990,11 +4996,49 @@ public class BookGroupBizImpl implements BookGroupBiz {
...
@@ -4990,11 +4996,49 @@ public class BookGroupBizImpl implements BookGroupBiz {
if
(
ListUtils
.
isEmpty
(
serveDTOList
))
{
if
(
ListUtils
.
isEmpty
(
serveDTOList
))
{
return
new
PageBeanNew
<>(
0
,
1
,
0
,
new
ArrayList
<>());
return
new
PageBeanNew
<>(
0
,
1
,
0
,
new
ArrayList
<>());
}
}
fillCollect4Book
(
wechatUserId
,
serveDTOList
);
PageBeanNew
<
BookServeDTO
>
pageBeanNew
=
new
PageBeanNew
<
BookServeDTO
>(
0
,
serveDTOList
.
size
(),
serveDTOList
.
size
(),
serveDTOList
);
PageBeanNew
<
BookServeDTO
>
pageBeanNew
=
new
PageBeanNew
<
BookServeDTO
>(
0
,
serveDTOList
.
size
(),
serveDTOList
.
size
(),
serveDTOList
);
pageBeanNew
.
setPageCount
(
1
);
pageBeanNew
.
setPageCount
(
1
);
return
pageBeanNew
;
return
pageBeanNew
;
}
}
private
void
fillCollect4Book
(
Long
wechatUserId
,
List
<
BookServeDTO
>
serveDTOList
)
{
if
(
ListUtils
.
isEmpty
(
serveDTOList
)
||
null
==
wechatUserId
)
{
return
;
}
List
<
ServeCollect
>
serveCollects
=
new
ArrayList
<>();
serveDTOList
.
forEach
(
e
->
{
ServeCollect
serveCollect
=
new
ServeCollect
();
serveCollect
.
setWechatUserId
(
wechatUserId
);
serveCollect
.
setServeId
(
e
.
getServeId
());
serveCollect
.
setServeType
(
Objects
.
equals
(
e
.
getServeType
(),
AppAndProductTypeEnum
.
PRODUCT
.
value
)
?
AppletRecordTypeEnum
.
PRODUCT
.
value
:
AppletRecordTypeEnum
.
APP
.
value
);
serveCollects
.
add
(
serveCollect
);
});
List
<
ServeCollect
>
serveCollectList
=
serveCollectBiz
.
getList4RightsSetting
(
serveCollects
);
if
(
ListUtils
.
isEmpty
(
serveCollectList
))
{
return
;
}
List
<
ServeCollect
>
collect4Product
=
serveCollectList
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getServeType
(),
AppletRecordTypeEnum
.
PRODUCT
.
value
)).
collect
(
Collectors
.
toList
());
List
<
ServeCollect
>
collect4App
=
serveCollectList
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getServeType
(),
AppletRecordTypeEnum
.
APP
.
value
)).
collect
(
Collectors
.
toList
());
Map
<
Long
,
ServeCollect
>
serveCollectMap4Product
=
new
HashMap
<>();
Map
<
Long
,
ServeCollect
>
serveCollectMap4App
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
collect4Product
))
{
serveCollectMap4Product
=
collect4Product
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getServeId
(),
a
->
a
,
(
k1
,
k2
)
->
k1
));
}
if
(!
ListUtils
.
isEmpty
(
collect4App
))
{
serveCollectMap4App
=
collect4App
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getServeId
(),
a
->
a
,
(
k1
,
k2
)
->
k1
));
}
for
(
BookServeDTO
bookServeDTO
:
serveDTOList
)
{
if
(
Objects
.
equals
(
bookServeDTO
.
getServeType
(),
AppAndProductTypeEnum
.
PRODUCT
.
value
)
&&
MapUtils
.
isNotEmpty
(
serveCollectMap4Product
)
&&
null
!=
serveCollectMap4Product
.
get
(
bookServeDTO
.
getServeId
()))
{
bookServeDTO
.
setIsCollect
(
YesOrNoEnums
.
YES
.
getValue
());
}
else
if
(
Objects
.
equals
(
bookServeDTO
.
getServeType
(),
AppAndProductTypeEnum
.
APP
.
value
)
&&
MapUtils
.
isNotEmpty
(
serveCollectMap4App
)
&&
null
!=
serveCollectMap4App
.
get
(
bookServeDTO
.
getServeId
()))
{
bookServeDTO
.
setIsCollect
(
YesOrNoEnums
.
YES
.
getValue
());
}
}
}
@ParamLog
(
"移除不能购买的应用或作品"
)
@ParamLog
(
"移除不能购买的应用或作品"
)
public
void
removeCanNotBuy
(
List
<
BookServeDTO
>
list
)
{
public
void
removeCanNotBuy
(
List
<
BookServeDTO
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
))
{
if
(
ListUtils
.
isEmpty
(
list
))
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/dto/BookServeDTO.java
View file @
0f5779b1
...
@@ -40,4 +40,6 @@ public class BookServeDTO extends BaseDto {
...
@@ -40,4 +40,6 @@ public class BookServeDTO extends BaseDto {
private
String
typeCode
;
private
String
typeCode
;
private
Double
price
;
private
Double
price
;
private
Integer
isCollect
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/BookGroupFacade.java
View file @
0f5779b1
...
@@ -726,6 +726,7 @@ public interface BookGroupFacade {
...
@@ -726,6 +726,7 @@ public interface BookGroupFacade {
@ApiOperation
(
"获取小睿社群书和现代纸书所配资源"
)
@ApiOperation
(
"获取小睿社群书和现代纸书所配资源"
)
@GetMapping
(
"getBookAndBookGroupServeList"
)
@GetMapping
(
"getBookAndBookGroupServeList"
)
ResponseDto
<?>
getBookAndBookGroupServeList
(
ResponseDto
<?>
getBookAndBookGroupServeList
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
);
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
);
@ApiOperation
(
"获取图书基本信息-小程序首页"
)
@ApiOperation
(
"获取图书基本信息-小程序首页"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/BookGroupFacadeImpl.java
View file @
0f5779b1
...
@@ -1185,11 +1185,13 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
...
@@ -1185,11 +1185,13 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@Override
@Override
@GetMapping
(
"getBookAndBookGroupServeList"
)
@GetMapping
(
"getBookAndBookGroupServeList"
)
public
ResponseDto
<?>
getBookAndBookGroupServeList
(
public
ResponseDto
<?>
getBookAndBookGroupServeList
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
)
{
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
)
{
if
(
null
==
adviserId
||
null
==
bookId
||
null
==
channelId
)
{
if
(
null
==
adviserId
||
null
==
bookId
||
null
==
channelId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
}
return
new
ResponseDto
<>(
bookGroupBiz
.
getBookAndBookGroupServeList
(
adviserId
,
bookId
,
channelId
));
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
bookGroupBiz
.
getBookAndBookGroupServeList
(
adviserId
,
bookId
,
channelId
,
wechatUserId
));
}
}
@Override
@Override
...
...
pcloud-service-book/src/main/java/com/pcloud/book/record/mapper/RegionMapMapper.java
View file @
0f5779b1
...
@@ -8,8 +8,10 @@ import java.util.Map;
...
@@ -8,8 +8,10 @@ import java.util.Map;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.MapKey
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Component
;
@Mapper
@Mapper
@Component
public
interface
RegionMapMapper
{
public
interface
RegionMapMapper
{
int
deleteByPrimaryKey
(
Long
id
);
int
deleteByPrimaryKey
(
Long
id
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
View file @
0f5779b1
...
@@ -14,7 +14,6 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
...
@@ -14,7 +14,6 @@ import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import
com.pcloud.book.skill.dto.GroupActivity4AppletDTO
;
import
com.pcloud.book.skill.dto.GroupActivity4AppletDTO
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -116,7 +115,7 @@ public interface RightsSettingBiz {
...
@@ -116,7 +115,7 @@ public interface RightsSettingBiz {
FillRightsSettingAppletsDTO
getFillRightsSettingApplets
(
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
FillRightsSettingAppletsDTO
getFillRightsSettingApplets
(
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
Integer
top
,
Long
bookId
,
Long
officialAccountsId
);
Integer
top
,
Long
bookId
,
Long
officialAccountsId
);
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
,
Integer
readType
);
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
,
Integer
readType
,
Long
wechatUserId
);
RightsSettingDto
getRightSettingByBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
);
RightsSettingDto
getRightSettingByBookId
(
Long
bookId
,
Long
adviserId
,
Long
channelId
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
View file @
0f5779b1
...
@@ -10,6 +10,7 @@ import com.pcloud.book.applet.biz.AppletBooklistBiz;
...
@@ -10,6 +10,7 @@ import com.pcloud.book.applet.biz.AppletBooklistBiz;
import
com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz
;
import
com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.AppletUserBookcaseBiz
;
import
com.pcloud.book.applet.biz.ServeCollectBiz
;
import
com.pcloud.book.applet.dao.AppletNewsDao
;
import
com.pcloud.book.applet.dao.AppletNewsDao
;
import
com.pcloud.book.applet.dao.AppletUserBookcaseDao
;
import
com.pcloud.book.applet.dao.AppletUserBookcaseDao
;
import
com.pcloud.book.applet.dto.AppletGroupStatementDTO
;
import
com.pcloud.book.applet.dto.AppletGroupStatementDTO
;
...
@@ -18,6 +19,7 @@ import com.pcloud.book.applet.dto.AppletNewsServeDTO;
...
@@ -18,6 +19,7 @@ import com.pcloud.book.applet.dto.AppletNewsServeDTO;
import
com.pcloud.book.applet.dto.AppletOuterBooklistDTO
;
import
com.pcloud.book.applet.dto.AppletOuterBooklistDTO
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletNews
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.AppletUserBookcase
;
import
com.pcloud.book.applet.entity.ServeCollect
;
import
com.pcloud.book.applet.enums.AppletNewsServeTypeEnum
;
import
com.pcloud.book.applet.enums.AppletNewsServeTypeEnum
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.applet.enums.AppletRecordTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
...
@@ -88,7 +90,6 @@ import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper;
...
@@ -88,7 +90,6 @@ import com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.dto.GroupActivity4AppletDTO
;
import
com.pcloud.book.skill.dto.GroupActivity4AppletDTO
;
import
com.pcloud.book.skill.enums.ActivityGroupTypeEnum
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
...
@@ -125,7 +126,6 @@ import java.util.concurrent.atomic.AtomicInteger;
...
@@ -125,7 +126,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
@Service
@Service
...
@@ -211,6 +211,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -211,6 +211,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private
AppletBooklistBiz
appletBooklistBiz
;
private
AppletBooklistBiz
appletBooklistBiz
;
@Autowired
@Autowired
private
AdviserConsr
adviserConsr
;
private
AdviserConsr
adviserConsr
;
@Autowired
private
ServeCollectBiz
serveCollectBiz
;
@Override
@Override
@ParamLog
(
"新增权益设置"
)
@ParamLog
(
"新增权益设置"
)
...
@@ -882,7 +884,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -882,7 +884,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
}
}
rightsSettingNow
.
setRightsSettingTitles
(
rightsSettingTitles
);
rightsSettingNow
.
setRightsSettingTitles
(
rightsSettingTitles
);
rightsSettingNow
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
null
,
null
,
null
,
false
,
null
));
rightsSettingNow
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
null
,
null
,
null
,
false
,
null
,
null
));
rightsSettingNow
.
setServesTitle
(
servesTitle
);
rightsSettingNow
.
setServesTitle
(
servesTitle
);
rightsSetting
.
setRightsSettingNow
(
rightsSettingNow
);
rightsSetting
.
setRightsSettingNow
(
rightsSettingNow
);
List
<
RightsSettingTitle
>
newRightsSettingTitles
=
new
ArrayList
<>
(
rightsSettingTitles
);
List
<
RightsSettingTitle
>
newRightsSettingTitles
=
new
ArrayList
<>
(
rightsSettingTitles
);
...
@@ -2073,7 +2075,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -2073,7 +2075,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
// 获取配套资料
// 获取配套资料
if
(
RightsNowItemTypeNew
.
SERVES
.
value
.
equals
(
type
))
{
if
(
RightsNowItemTypeNew
.
SERVES
.
value
.
equals
(
type
))
{
return
setServe
(
rightsSetting
,
adviserId
,
bookId
,
channelId
,
readType
);
RightsSetting
rightsSetting4Serves
=
setServe
(
rightsSetting
,
adviserId
,
bookId
,
channelId
,
readType
);
fillCollect
(
wechatUserId
,
rightsSetting4Serves
,
type
);
}
}
// 获取抽奖权益
// 获取抽奖权益
if
(
RightsNowItemTypeNew
.
DRAW
.
value
.
equals
(
type
))
{
if
(
RightsNowItemTypeNew
.
DRAW
.
value
.
equals
(
type
))
{
...
@@ -2106,6 +2109,74 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -2106,6 +2109,74 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
return
rightsSetting
;
return
rightsSetting
;
}
}
private
void
fillCollect
(
Long
wechatUserId
,
RightsSetting
rightsSetting4Serves
,
Integer
type
)
{
if
(
null
==
wechatUserId
)
{
return
;
}
if
(
RightsNowItemTypeNew
.
SERVES
.
value
.
equals
(
type
))
{
List
<
RightsItemGroup
>
rightsItemGroups
=
rightsSetting4Serves
.
getRightsItemGroups
();
if
(
ListUtils
.
isEmpty
(
rightsItemGroups
))
{
return
;
}
List
<
RightsNowItem
>
rightsNowItems
=
new
ArrayList
<>();
rightsItemGroups
.
forEach
(
rightsItemGroup
->
{
List
<
RightsNowItem
>
nowItems
=
rightsItemGroup
.
getRightsNowItems
();
if
(
ListUtils
.
isEmpty
(
nowItems
))
{
return
;
}
List
<
RightsNowItem
>
productOrApps
=
nowItems
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getServeType
(),
AppAndProductTypeEnum
.
PRODUCT
.
value
)
||
Objects
.
equals
(
e
.
getServeType
(),
AppAndProductTypeEnum
.
APP
.
value
)).
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
productOrApps
))
{
rightsNowItems
.
addAll
(
productOrApps
);
}
});
if
(
ListUtils
.
isEmpty
(
rightsNowItems
))
{
return
;
}
List
<
ServeCollect
>
serveCollects
=
new
ArrayList
<>();
rightsNowItems
.
forEach
(
e
->
{
ServeCollect
serveCollect
=
new
ServeCollect
();
serveCollect
.
setWechatUserId
(
wechatUserId
);
serveCollect
.
setServeId
(
e
.
getServeId
());
serveCollect
.
setServeType
(
Objects
.
equals
(
e
.
getServeType
(),
AppAndProductTypeEnum
.
PRODUCT
.
value
)
?
AppletRecordTypeEnum
.
PRODUCT
.
value
:
AppletRecordTypeEnum
.
APP
.
value
);
serveCollects
.
add
(
serveCollect
);
});
List
<
ServeCollect
>
serveCollectList
=
serveCollectBiz
.
getList4RightsSetting
(
serveCollects
);
if
(
ListUtils
.
isEmpty
(
serveCollectList
))
{
return
;
}
List
<
ServeCollect
>
collect4Product
=
serveCollectList
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getServeType
(),
AppletRecordTypeEnum
.
PRODUCT
.
value
)).
collect
(
Collectors
.
toList
());
List
<
ServeCollect
>
collect4App
=
serveCollectList
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getServeType
(),
AppletRecordTypeEnum
.
APP
.
value
)).
collect
(
Collectors
.
toList
());
Map
<
Long
,
ServeCollect
>
serveCollectMap4Product
=
new
HashMap
<>();
Map
<
Long
,
ServeCollect
>
serveCollectMap4App
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
collect4Product
))
{
serveCollectMap4Product
=
collect4Product
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getServeId
(),
a
->
a
,
(
k1
,
k2
)
->
k1
));
}
if
(!
ListUtils
.
isEmpty
(
collect4App
))
{
serveCollectMap4App
=
collect4App
.
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getServeId
(),
a
->
a
,
(
k1
,
k2
)
->
k1
));
}
for
(
RightsItemGroup
rightsItemGroup
:
rightsItemGroups
)
{
List
<
RightsNowItem
>
nowItems
=
rightsItemGroup
.
getRightsNowItems
();
if
(
ListUtils
.
isEmpty
(
nowItems
))
{
continue
;
}
List
<
RightsNowItem
>
productOrApps
=
nowItems
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getServeType
(),
AppAndProductTypeEnum
.
PRODUCT
.
value
)
||
Objects
.
equals
(
e
.
getServeType
(),
AppAndProductTypeEnum
.
APP
.
value
)).
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
productOrApps
))
{
for
(
RightsNowItem
rightsNowItem
:
productOrApps
)
{
if
(
Objects
.
equals
(
rightsNowItem
.
getServeType
(),
AppAndProductTypeEnum
.
PRODUCT
.
value
)
&&
MapUtils
.
isNotEmpty
(
serveCollectMap4Product
)
&&
null
!=
serveCollectMap4Product
.
get
(
rightsNowItem
.
getServeId
()))
{
rightsNowItem
.
setIsCollect
(
YesOrNoEnums
.
YES
.
getValue
());
}
else
if
(
Objects
.
equals
(
rightsNowItem
.
getServeType
(),
AppAndProductTypeEnum
.
APP
.
value
)
&&
MapUtils
.
isNotEmpty
(
serveCollectMap4App
)
&&
null
!=
serveCollectMap4App
.
get
(
rightsNowItem
.
getServeId
()))
{
rightsNowItem
.
setIsCollect
(
YesOrNoEnums
.
YES
.
getValue
());
}
}
}
}
}
}
@ParamLog
(
value
=
"填充专享社群"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"填充专享社群"
,
isAfterReturn
=
false
)
private
RightsSetting
setGroupService
(
RightsSetting
rightsSetting
,
Long
wechatUserId
,
Integer
readType
,
Long
bookId
,
Integer
currentPage
,
Integer
numPerPage
,
Long
officialAccountsId
)
{
private
RightsSetting
setGroupService
(
RightsSetting
rightsSetting
,
Long
wechatUserId
,
Integer
readType
,
Long
bookId
,
Integer
currentPage
,
Integer
numPerPage
,
Long
officialAccountsId
)
{
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemTypeNew
.
GROUP_SERVICE
,
readType
);
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemTypeNew
.
GROUP_SERVICE
,
readType
);
...
@@ -2260,7 +2331,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -2260,7 +2331,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
RightsSettingTitle
rightsSettingTitle
=
rightsSettingTitleMapper
RightsSettingTitle
rightsSettingTitle
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightsSetting
.
getId
(),
RightsNowItemTypeNew
.
SERVES
.
value
,
null
);
.
getByRightSettingIdAndType
(
rightsSetting
.
getId
(),
RightsNowItemTypeNew
.
SERVES
.
value
,
null
);
rightsSetting
.
setServesTitle
(
rightsSettingTitle
!=
null
?
rightsSettingTitle
:
new
RightsSettingTitle
());
rightsSetting
.
setServesTitle
(
rightsSettingTitle
!=
null
?
rightsSettingTitle
:
new
RightsSettingTitle
());
rightsSetting
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
adviserId
,
bookId
,
channelId
,
true
,
readType
));
rightsSetting
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
adviserId
,
bookId
,
channelId
,
true
,
readType
,
null
));
return
rightsSetting
;
return
rightsSetting
;
}
}
...
@@ -2371,7 +2442,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -2371,7 +2442,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@ParamLog
(
"根据权益id获取即享权益配套资料分组集合"
)
@ParamLog
(
"根据权益id获取即享权益配套资料分组集合"
)
@Override
@Override
public
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
public
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
,
Integer
readType
)
{
Boolean
removeCanNotBuy
,
Integer
readType
,
Long
wechatUserId
)
{
if
(
rightsSettingId
==
null
)
{
if
(
rightsSettingId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
}
...
@@ -2423,7 +2494,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
...
@@ -2423,7 +2494,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
for
(
RightsItemGroup
group
:
groups
)
{
for
(
RightsItemGroup
group
:
groups
)
{
group
.
setRightsNowItems
(
itemMap
.
get
(
group
.
getId
()));
group
.
setRightsNowItems
(
itemMap
.
get
(
group
.
getId
()));
}
}
return
groups
;
RightsSetting
rightsSetting4Serves
=
new
RightsSetting
();
rightsSetting4Serves
.
setRightsItemGroups
(
groups
);
fillCollect
(
wechatUserId
,
rightsSetting4Serves
,
RightsNowItemTypeNew
.
SERVES
.
value
);
return
rightsSetting4Serves
.
getRightsItemGroups
();
}
}
@ParamLog
(
"获取即享权益图片库"
)
@ParamLog
(
"获取即享权益图片库"
)
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsNowItem.java
View file @
0f5779b1
...
@@ -111,5 +111,6 @@ public class RightsNowItem extends BaseEntity {
...
@@ -111,5 +111,6 @@ public class RightsNowItem extends BaseEntity {
private
Integer
isShow
;
private
Integer
isShow
;
@ApiModelProperty
(
"社群头图地址"
)
@ApiModelProperty
(
"社群头图地址"
)
private
String
showUrl
;
private
String
showUrl
;
@ApiModelProperty
(
"是否收藏"
)
private
Integer
isCollect
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/facade/RightsSettingFacede.java
View file @
0f5779b1
...
@@ -228,11 +228,11 @@ public class RightsSettingFacede {
...
@@ -228,11 +228,11 @@ public class RightsSettingFacede {
@RequestParam
(
"channelId"
)
Long
channelId
,
@RequestParam
(
"channelId"
)
Long
channelId
,
@RequestParam
(
value
=
"readType"
,
required
=
false
)
@ApiParam
(
"阅读方式1轻松2高效3深度"
)
Integer
readType
@RequestParam
(
value
=
"readType"
,
required
=
false
)
@ApiParam
(
"阅读方式1轻松2高效3深度"
)
Integer
readType
)
throws
PermissionException
{
)
throws
PermissionException
{
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
){
if
(
null
==
rightsSettingId
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsItemGroups
(
rightsSettingId
,
adviserId
,
bookId
,
channelId
,
true
,
readType
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsItemGroups
(
rightsSettingId
,
adviserId
,
bookId
,
channelId
,
true
,
readType
,
wechatUserId
));
}
}
@ApiOperation
(
"根据书刊的分类获取对应的分类权益信息"
)
@ApiOperation
(
"根据书刊的分类获取对应的分类权益信息"
)
...
...
pcloud-service-book/src/main/resources/mapper/applet/ServeCollect.Mapper.xml
0 → 100644
View file @
0f5779b1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.pcloud.book.applet.dao.impl.ServeCollectDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.applet.entity.ServeCollect"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"wechat_user_id"
property=
"wechatUserId"
jdbcType=
"BIGINT"
/>
<result
column=
"serve_id"
property=
"serveId"
jdbcType=
"BIGINT"
/>
<result
column=
"serve_type"
property=
"serveType"
jdbcType=
"INTEGER"
/>
<result
column=
"serve_name"
property=
"serveName"
jdbcType=
"VARCHAR"
/>
<result
column=
"serve_code"
property=
"serveCode"
jdbcType=
"INTEGER"
/>
<result
column=
"serve_type_code"
property=
"serveTypeCode"
jdbcType=
"INTEGER"
/>
<result
column=
"link_url"
property=
"linkUrl"
jdbcType=
"VARCHAR"
/>
<result
column=
"is_delete"
property=
"isDelete"
jdbcType=
"INTEGER"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"collect_day"
property=
"collectDay"
jdbcType=
"DATE"
/>
<result
column=
"pic_url"
property=
"picUrl"
jdbcType=
"VARCHAR"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, wechat_user_id, serve_id, serve_name,serve_type, serve_code,serve_type_code, link_url, is_delete, create_time, update_time, collect_day,
pic_url
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM serve_collect
WHERE id = #{id}
</select>
<select
id=
"getList"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM serve_collect
where
wechat_user_id = #{wechatUserId}
and
is_delete = 0
order by
update_time desc
</select>
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO serve_collect(
wechat_user_id,
serve_id,
serve_name,
serve_type,
serve_type_Code,
link_url,
pic_url,
is_delete,
create_time,
update_time,
collect_day
) VALUES (
#{wechatUserId, jdbcType=BIGINT},
#{serveId, jdbcType=BIGINT},
#{serveName},
#{serveType, jdbcType=INTEGER},
#{serveTypeCode, jdbcType=VARCHAR},
#{linkUrl, jdbcType=VARCHAR},
#{picUrl},
#{isDelete, jdbcType=INTEGER},
now(),
now(),
CURDATE()
) on duplicate key
update
update_time = now(),
collect_day = CURDATE()
<if
test=
"isDelete != null"
>
, is_delete = #{isDelete}
</if>
</insert>
<insert
id=
"batchInsert"
>
INSERT INTO serve_collect (
wechat_user_id,
serve_id,
serve_type,
serve_code,
link_url,
is_delete,
create_time,
update_time,
collect_day
) VALUES
<foreach
collection=
"list"
item=
"item"
separator=
","
>
(
#{item.wechatUserId, jdbcType=BIGINT},
#{item.serveId, jdbcType=BIGINT},
#{item.serveType, jdbcType=INTEGER},
#{item.serveCode, jdbcType=INTEGER},
#{item.linkUrl, jdbcType=VARCHAR},
#{item.isDelete, jdbcType=INTEGER},
now(),
now(),
CURDATE()
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update
id=
"update"
>
UPDATE serve_collect
<set>
<if
test=
"wechatUserId != null"
>
wechat_user_id = #{wechatUserId},
</if>
<if
test=
"serveId != null"
>
serve_id = #{serveId},
</if>
<if
test=
"serveType != null"
>
serve_type = #{serveType},
</if>
<if
test=
"serveCode != null"
>
serve_code = #{serveCode},
</if>
<if
test=
"linkUrl != null and linkUrl != ''"
>
link_url = #{linkUrl},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"collectDay != null"
>
collect_day = #{collectDay},
</if>
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete
id=
"deleteById"
>
DELETE FROM serve_collect where id = #{id}
</delete>
<update
id=
"cancelCollect"
parameterType=
"list"
>
update
serve_collect
set
is_delete = 1,
update_time = now()
where
id in
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</update>
<update
id=
"deleteInvalidNews"
parameterType=
"list"
>
update
serve_collect
set
is_delete = 1
where
serve_id in
<foreach
collection=
"list"
index=
"index"
item=
"item"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
and serve_type = 1
</update>
<select
id=
"getList4RightsSetting"
parameterType=
"list"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from
serve_collect
<where>
is_delete = 0
and
<foreach
collection=
"list"
item=
"item"
open=
"("
separator=
"or"
close=
")"
>
wechat_user_id = #{item.wechatUserId}
and
serve_id = #{item.serveId}
and
serve_type = #{item.serveType}
</foreach>
</where>
</select>
<select
id=
"getAllCollect"
parameterType=
"list"
resultType=
"long"
>
select
id
from
serve_collect
where
is_delete = 0
and
wechat_user_id = #{wechatUserId}
</select>
</mapper>
\ No newline at end of file
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