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
8e45e3a6
Commit
8e45e3a6
authored
Apr 29, 2020
by
裴大威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-1002817' into 'master'
1002817本书配套资料包内资源分类,支持配置分类资源录入 See merge request rays/pcloud-book!680
parents
bc129ede
30cc5e69
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
950 additions
and
246 deletions
+950
-246
AppletHomeFacade.java
.../java/com/pcloud/book/applet/facade/AppletHomeFacade.java
+6
-6
WechatGroupConsr.java
...om/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
+1
-1
RightsSettingBiz.java
...a/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
+22
-1
RightsSettingBizImpl.java
...oud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
+493
-177
RightsSettingCheck.java
...m/pcloud/book/rightsSetting/check/RightsSettingCheck.java
+26
-4
RightsSettingConstant.java
...d/book/rightsSetting/constants/RightsSettingConstant.java
+15
-0
RightsItemGroupDao.java
...com/pcloud/book/rightsSetting/dao/RightsItemGroupDao.java
+23
-0
RightsNowItemDao.java
...a/com/pcloud/book/rightsSetting/dao/RightsNowItemDao.java
+2
-0
RightsItemGroupDaoImpl.java
...d/book/rightsSetting/dao/impl/RightsItemGroupDaoImpl.java
+35
-0
RightsNowItemDaoImpl.java
...oud/book/rightsSetting/dao/impl/RightsNowItemDaoImpl.java
+7
-0
FillRightsSettingAppletsDTO.java
...d/book/rightsSetting/dto/FillRightsSettingAppletsDTO.java
+7
-0
RightsItemGroup.java
...com/pcloud/book/rightsSetting/entity/RightsItemGroup.java
+52
-0
RightsNowItem.java
...a/com/pcloud/book/rightsSetting/entity/RightsNowItem.java
+25
-7
RightsSetting.java
...a/com/pcloud/book/rightsSetting/entity/RightsSetting.java
+3
-0
RightsItemGroupType.java
.../pcloud/book/rightsSetting/enums/RightsItemGroupType.java
+22
-0
RightsNowItemType.java
...om/pcloud/book/rightsSetting/enums/RightsNowItemType.java
+1
-2
RightsSettingFacede.java
...pcloud/book/rightsSetting/facade/RightsSettingFacede.java
+64
-31
PcloudGroupActivityBiz.java
...ava/com/pcloud/book/skill/biz/PcloudGroupActivityBiz.java
+1
-5
PcloudGroupActivityBizImpl.java
...cloud/book/skill/biz/impl/PcloudGroupActivityBizImpl.java
+30
-6
GroupActivity4AppletDTO.java
...va/com/pcloud/book/skill/dto/GroupActivity4AppletDTO.java
+9
-0
RightItemGroup.xml
...rc/main/resources/mapper/rightssetting/RightItemGroup.xml
+83
-0
RightNowItem.xml
.../src/main/resources/mapper/rightssetting/RightNowItem.xml
+23
-6
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/applet/facade/AppletHomeFacade.java
View file @
8e45e3a6
...
...
@@ -596,16 +596,16 @@ public class AppletHomeFacade {
@GetMapping
(
"getGroupActivity4Applet"
)
public
ResponseDto
<?>
getGroupActivity4Applet
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"
firstClassify"
,
required
=
true
)
Long
firstClassify
,
@RequestParam
(
value
=
"
secondClassify"
,
required
=
false
)
Long
secondClassify
,
@RequestParam
(
value
=
"
gradeLabelId"
,
required
=
false
)
Long
gradeLabel
Id
,
@RequestParam
(
value
=
"
subjectLabelId"
,
required
=
false
)
Long
subjectLab
elId
)
throws
PermissionException
{
@RequestParam
(
value
=
"
adviserId"
)
Long
adviserId
,
@RequestParam
(
value
=
"
bookId"
)
Long
bookId
,
@RequestParam
(
value
=
"
rightsSettingId"
)
Long
rightsSetting
Id
,
@RequestParam
(
value
=
"
channelId"
)
Long
chann
elId
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
wechatUserId
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少参数"
);
}
return
new
ResponseDto
<>(
pcloudGroupActivityBiz
.
getGroupActivity4Applet
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLab
elId
));
return
new
ResponseDto
<>(
pcloudGroupActivityBiz
.
getGroupActivity4Applet
(
rightsSettingId
,
adviserId
,
bookId
,
chann
elId
));
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/consumer/wechatgroup/WechatGroupConsr.java
View file @
8e45e3a6
...
...
@@ -752,7 +752,7 @@ public class WechatGroupConsr {
}
}
public
void
sendMessageToMiniUser
(
SendMessageDTO
sendMessageDTO
)
{
public
void
sendMessageToMiniUser
(
SendMessageDTO
sendMessageDTO
)
{
try
{
selfRobotService
.
sendMessageToMiniUser
(
sendMessageDTO
);
}
catch
(
Exception
e
)
{
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/RightsSettingBiz.java
View file @
8e45e3a6
...
...
@@ -3,6 +3,7 @@ package com.pcloud.book.rightsSetting.biz;
import
com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsItemGroup
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
...
...
@@ -77,9 +78,29 @@ public interface RightsSettingBiz {
*/
List
<
RightsSettingClassify
>
getAllRightsClassify
(
String
rightsType
);
/**
* @Author David
* @Description 该方法没有补充咨询且会查询所有类型的即可权益,不利于扩展,请使用新方法getRightsSettingRightsNowItemsByType
* @Date 2020/4/25 11:44
* @Param [rightsSettingId, wechatUserId]
* @return com.pcloud.book.rightsSetting.entity.RightsSetting
**/
@Deprecated
RightsSetting
getRightsSettingRightsNowItems
(
Long
rightsSettingId
,
Long
wechatUserId
);
/**
* @Author David
* @Description 根据权益id和类型获取权益内容
* @Date 2020/4/25 11:44
* @Param [rightsSettingId, wechatUserId, type]
* @return com.pcloud.book.rightsSetting.entity.RightsSetting
**/
RightsSetting
getRightsSettingRightsNowItemsByType
(
Long
rightsSettingId
,
Long
wechatUserId
,
Integer
type
);
RightsSetting
getRightsSettingGiftCoupons
(
Long
rightsSettingId
,
Long
wechatUserId
);
FillRightsSettingAppletsDTO
getFillRightsSettingApplets
(
Long
rightsSettingId
,
Long
wechatUserId
);
FillRightsSettingAppletsDTO
getFillRightsSettingApplets
(
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
Integer
top
);
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
);
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
View file @
8e45e3a6
package
com
.
pcloud
.
book
.
rightsSetting
.
biz
.
impl
;
import
com.google.common.collect.Lists
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
...
...
@@ -19,28 +21,34 @@ import com.pcloud.book.consumer.app.AssistTempletConsr;
import
com.pcloud.book.consumer.channel.QrcodeSceneConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.giftcoupon.dao.GiftReceiveDao
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dto.BookServeDTO
;
import
com.pcloud.book.group.enums.AppAndProductTypeEnum
;
import
com.pcloud.book.group.tools.SendWeixinRequestTools
;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.check.RightsSettingCheck
;
import
com.pcloud.book.rightsSetting.constants.RightsSettingConstant
;
import
com.pcloud.book.rightsSetting.dao.RightsItemGroupDao
;
import
com.pcloud.book.rightsSetting.dao.RightsNowItemDao
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingDAO
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingItemDao
;
import
com.pcloud.book.rightsSetting.dao.check.RightsSettingCheck
;
import
com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsItemGroup
;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingTitle
;
import
com.pcloud.book.rightsSetting.enums.RightsItemGroupType
;
import
com.pcloud.book.rightsSetting.enums.RightsNowItemType
;
import
com.pcloud.book.rightsSetting.enums.RightsTypeEnum
;
import
com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper
;
import
com.pcloud.book.util.common.CommonUtils
;
import
com.pcloud.book.util.common.YesOrNoEnums
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.channelcenter.wechat.dto.BookServeParamVO
;
import
com.pcloud.channelcenter.wechat.vo.BookServeVO
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
...
...
@@ -48,10 +56,8 @@ import com.pcloud.common.utils.ListUtils;
import
com.pcloud.common.utils.cache.redis.JedisClusterUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.util.function.Function
;
import
lombok.NonNull
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -59,13 +65,18 @@ import org.springframework.beans.factory.annotation.Value;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Random
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
lombok.extern.slf4j.Slf4j
;
@Service
@Slf4j
public
class
RightsSettingBizImpl
implements
RightsSettingBiz
{
...
...
@@ -102,14 +113,18 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private
BookBiz
bookBiz
;
@Autowired
private
RightsSettingTitleMapper
rightsSettingTitleMapper
;
@Autowired
private
RightsItemGroupDao
rightsItemGroupDao
;
@Autowired
private
BookGroupBiz
bookGroupBiz
;
@Override
@ParamLog
(
"新增权益设置"
)
public
Long
addRightsSetting
(
RightsSetting
rightsSetting
)
{
rightsSettingCheck
.
rightsSettingCheck
(
rightsSetting
);
setClassifyAndLabel
(
rightsSetting
);
if
(
existCheck
(
rightsSetting
)
>
0
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"已存在相同的权益设置"
);
if
(
existCheck
(
rightsSetting
)
>
0
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"已存在相同的权益设置"
);
}
rightsSettingDAO
.
insert
(
rightsSetting
);
return
rightsSetting
.
getId
();
...
...
@@ -119,15 +134,15 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
public
void
setClassifyAndLabel
(
BaseTempletClassify
baseTempletClassify
)
{
log
.
info
(
"对于某些特殊分类做处理"
);
Boolean
contain4K12
=
false
;
if
(
"test"
.
equals
(
envStr
)
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
K12_TEMPLET_ID_TEST
,
baseTempletClassify
.
getFirstClassify
()))
{
if
(
"test"
.
equals
(
envStr
)
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
K12_TEMPLET_ID_TEST
,
baseTempletClassify
.
getFirstClassify
()))
{
contain4K12
=
true
;
}
else
if
(!
"test"
.
equals
(
envStr
)
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
K12_TEMPLET_ID
,
baseTempletClassify
.
getFirstClassify
()))
{
}
else
if
(!
"test"
.
equals
(
envStr
)
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
K12_TEMPLET_ID
,
baseTempletClassify
.
getFirstClassify
()))
{
contain4K12
=
true
;
}
if
(!
ArrayUtils
.
contains
(
RightsSettingConstant
.
MEDICAL_INSURANCE_TEMPLET_ID
,
baseTempletClassify
.
getFirstClassify
()))
{
if
(!
ArrayUtils
.
contains
(
RightsSettingConstant
.
MEDICAL_INSURANCE_TEMPLET_ID
,
baseTempletClassify
.
getFirstClassify
()))
{
baseTempletClassify
.
setSecondClassify
(
null
);
}
if
(!
contain4K12
){
if
(!
contain4K12
)
{
baseTempletClassify
.
setGradeLabelId
(
null
);
baseTempletClassify
.
setSubjectLabelId
(
null
);
}
...
...
@@ -135,21 +150,22 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
/**
* 校验权益是否存在
*
* @param rightsSetting
*/
public
Integer
existCheck
(
RightsSetting
rightsSetting
){
Integer
count
=
0
;
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
public
Integer
existCheck
(
RightsSetting
rightsSetting
)
{
Integer
count
=
0
;
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"rightsSettingType"
,
rightsSetting
.
getRightsSettingType
());
paramMap
.
put
(
"exceptId"
,
rightsSetting
.
getId
());
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
paramMap
.
put
(
"bookId"
,
rightsSetting
.
getBookId
());
}
else
if
(
rightsSetting
.
getRightsSettingType
()==
1
)
{
}
else
if
(
rightsSetting
.
getRightsSettingType
()
==
1
)
{
setClassifyAndLabel
(
rightsSetting
);
paramMap
.
put
(
"firstClassify"
,
rightsSetting
.
getFirstClassify
());
paramMap
.
put
(
"secondClassify"
,
rightsSetting
.
getSecondClassify
());
paramMap
.
put
(
"gradeLabelId"
,
rightsSetting
.
getGradeLabelId
());
paramMap
.
put
(
"subjectLabelId"
,
rightsSetting
.
getSubjectLabelId
());
paramMap
.
put
(
"firstClassify"
,
rightsSetting
.
getFirstClassify
());
paramMap
.
put
(
"secondClassify"
,
rightsSetting
.
getSecondClassify
());
paramMap
.
put
(
"gradeLabelId"
,
rightsSetting
.
getGradeLabelId
());
paramMap
.
put
(
"subjectLabelId"
,
rightsSetting
.
getSubjectLabelId
());
}
List
<
RightsSettingDto
>
list
=
rightsSettingDAO
.
listRightsSettingPage
(
paramMap
);
count
=
list
.
size
();
...
...
@@ -162,18 +178,19 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSettingDAO
.
deleteByPrimaryKey
(
id
);
//删除即享权益项
rightsNowItemDao
.
deleteByRightsSettingId
(
id
);
rightsSettingItemDao
.
deleteByRightsSettingId
(
id
,
null
);
rightsSettingItemDao
.
deleteByRightsSettingId
(
id
,
null
);
rightsItemGroupDao
.
deleteByRightsSettingId
(
id
);
}
@Override
@ParamLog
(
"更新权益设置"
)
public
void
updateRightsSetting
(
RightsSetting
rightsSetting
)
{
rightsSettingCheck
.
rightsSettingCheck
(
rightsSetting
);
if
(
null
==
rightsSetting
.
getId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少id!"
);
if
(
null
==
rightsSetting
.
getId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"缺少id!"
);
}
if
(
existCheck
(
rightsSetting
)
>
0
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"已存在相同的权益设置"
);
if
(
existCheck
(
rightsSetting
)
>
0
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"已存在相同的权益设置"
);
}
setClassifyAndLabel
(
rightsSetting
);
rightsSetting
.
setUpdateTime
(
new
Date
());
...
...
@@ -181,8 +198,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
//更新即享权益
updateRightNowItemByRightId
(
rightsSetting
);
//新增/修改每周或长期权益
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingWeekItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
WEEK
.
value
);
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingLongTermItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
LONG_TERM
.
value
);
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingWeekItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
WEEK
.
value
);
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingLongTermItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
LONG_TERM
.
value
);
}
@ParamLog
(
"更新权益的即享权益项集合"
)
...
...
@@ -197,14 +214,13 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
setRightsSettingId
(
rightsSetting
,
rightsSettingId
,
rightsSettingTitles
);
//设置每个权益详情
setNowItems
(
rightsSetting
,
rightsSettingId
,
items
);
//处理权益配套资料分组
dealItemGroups
(
rightsSetting
,
rightsSettingId
,
items
);
//根据权益id删除原来的
rightsNowItemDao
.
deleteByRightsSettingId
(
rightsSettingId
);
if
(!
ListUtils
.
isEmpty
(
items
))
{
rightsNowItemDao
.
batchInsert
(
items
);
}
if
(!
ListUtils
.
isEmpty
(
rightsSettingTitles
))
{
rightsSettingTitles
.
stream
().
forEach
(
e
->
e
.
setRightsSettingId
(
rightsSettingId
));
}
if
(
null
!=
rightsSetting
.
getOnlineRightsSettingTitle
()
&&
null
==
rightsSetting
.
getOnlineRightsSettingTitle
().
getId
())
{
rightsSettingTitleMapper
.
deleteByRightSettingId
(
rightsSettingId
);
if
(!
ListUtils
.
isEmpty
(
rightsSettingTitles
))
{
...
...
@@ -216,6 +232,43 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
@ParamLog
(
"增加和删除分组"
)
private
void
dealItemGroups
(
RightsSetting
rightsSetting
,
Long
rightsSettingId
,
List
<
RightsNowItem
>
items
)
{
if
(
rightsSetting
==
null
||
ListUtils
.
isEmpty
(
rightsSetting
.
getRightsItemGroups
())){
return
;
}
for
(
RightsItemGroup
group:
rightsSetting
.
getRightsItemGroups
()){
//集合转化为三个描述
if
(!
ListUtils
.
isEmpty
(
group
.
getDescList
())){
if
(
group
.
getDescList
().
size
()>
0
){
group
.
setDesc1
(
group
.
getDescList
().
get
(
0
));
}
if
(
group
.
getDescList
().
size
()>
1
){
group
.
setDesc2
(
group
.
getDescList
().
get
(
1
));
}
if
(
group
.
getDescList
().
size
()>
2
){
group
.
setDesc3
(
group
.
getDescList
().
get
(
2
));
}
}
group
.
setRightsSettingId
(
rightsSettingId
);
}
//删除之前的
rightsItemGroupDao
.
deleteByRightsSettingId
(
rightsSettingId
);
//新增新的
rightsItemGroupDao
.
batchInsert
(
rightsSetting
.
getRightsItemGroups
());
for
(
RightsItemGroup
group:
rightsSetting
.
getRightsItemGroups
()){
if
(
ListUtils
.
isEmpty
(
group
.
getRightsNowItems
())){
continue
;
}
for
(
RightsNowItem
item:
group
.
getRightsNowItems
()){
item
.
setType
(
RightsNowItemType
.
SERVES
.
value
);
item
.
setRightsItemGroupId
(
group
.
getId
());
item
.
setRightsSettingId
(
rightsSettingId
);
items
.
add
(
item
);
}
}
}
private
void
setNowItems
(
RightsSetting
rightsSetting
,
Long
rightsSettingId
,
List
<
RightsNowItem
>
items
)
{
log
.
info
(
"填充即享权益具体项目的的基本参数"
);
if
(
null
!=
rightsSetting
.
getOnlineRightsSettingTitle
()
&&
!
ListUtils
...
...
@@ -305,13 +358,138 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSetting
.
setBookName
(
bookDto
==
null
?
""
:
bookDto
.
getBookName
());
}
fillRightsNowItems
(
rightsSetting
);
rightsSetting
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
null
,
null
,
null
,
false
));
fillGiftCouponPack
(
rightsSetting
);
rightsSetting
.
setRightsSettingWeekItems
(
getItemsByRightsSettingId
(
id
,
RightsTypeEnum
.
WEEK
.
value
));
rightsSetting
.
setRightsSettingLongTermItems
(
getItemsByRightsSettingId
(
id
,
RightsTypeEnum
.
LONG_TERM
.
value
));
return
rightsSetting
;
}
/**
* @return void
* @Author David
* @Description 设置线上网课
* @Date 2020/4/24 16:59
* @Param [rightsSetting, wechatUserId]
**/
@ParamLog
(
value
=
"填充线上网课"
,
isAfterReturn
=
false
)
private
RightsSetting
setOnlineCourse
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
ONLINE_COURSE
);
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
ONLINE_COURSE
.
value
));
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
ONLINE_COURSE
,
rightsSetting
.
getId
(),
wechatUserId
,
2L
,
3
);
rightsSetting
.
setOnlineRightsSettingTitle
(
rightsSettingTitle
);
return
rightsSetting
;
}
/**
* @Author David
* @Description 填充学习工具
* @Date 2020/4/24 20:10
* @Param [rightsSetting, wechatUserId]
* @return void
**/
@ParamLog
(
value
=
"填充学习工具"
,
isAfterReturn
=
false
)
private
RightsSetting
setLearningTool
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
LEARNING_TOOL
);
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
LEARNING_TOOL
.
value
));
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
LEARNING_TOOL
,
rightsSetting
.
getId
(),
wechatUserId
,
3L
,
1
);
rightsSetting
.
setLearningToolTitle
(
rightsSettingTitle
);
return
rightsSetting
;
}
/**
* @Author David
* @Description 填充抽奖
* @Date 2020/4/24 20:10
* @Param [rightsSetting, wechatUserId]
* @return void
**/
@ParamLog
(
value
=
"填充抽奖"
,
isAfterReturn
=
false
)
private
RightsSetting
setDraw
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
DRAW
);
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
Collections
.
singletonList
(
RightsNowItemType
.
DRAW
.
value
));
processNowItems
(
rightsSettingTitle
,
nowItems
,
RightsNowItemType
.
DRAW
,
rightsSetting
.
getId
(),
wechatUserId
,
4L
,
1
);
rightsSetting
.
setDrawSettingTitle
(
rightsSettingTitle
);
return
rightsSetting
;
}
@ParamLog
(
value
=
"填充礼券包"
,
isAfterReturn
=
false
)
private
RightsSetting
setGiftCouponPackage
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
fillGiftCouponPack
(
rightsSetting
);
fillUserGiftReceiveStatus
(
rightsSetting
,
wechatUserId
);
return
rightsSetting
;
}
/**
* @Author David
* @Description 获取权益标题
* @Date 2020/4/24 20:07
* @Param [rightsSetting, learningTool]
* @return com.pcloud.book.rightsSetting.entity.RightsSettingTitle
**/
private
RightsSettingTitle
getRightsSettingTitle
(
RightsSetting
rightsSetting
,
RightsNowItemType
learningTool
)
{
List
<
RightsSettingTitle
>
rightsSettingTitles
=
rightsSettingTitleMapper
.
getByRightSettingId
(
rightsSetting
.
getId
());
Map
<
Integer
,
RightsSettingTitle
>
rightsSettingTitleMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
rightsSettingTitles
))
{
rightsSettingTitleMap
=
rightsSettingTitles
.
stream
().
collect
(
Collectors
.
toMap
(
RightsSettingTitle:
:
getRightsSettingNowType
,
Function
.
identity
()));
}
RightsSettingTitle
rightsSettingTitle
=
new
RightsSettingTitle
();
if
(
null
!=
rightsSettingTitleMap
.
get
(
learningTool
.
value
))
{
rightsSettingTitle
=
rightsSettingTitleMap
.
get
(
learningTool
.
value
);
}
return
rightsSettingTitle
;
}
/**
* @return void
* @Author David
* @Description 处理即刻资源
* @Date 2020/4/24 17:45
* @Param [nowItems]
**/
private
void
processNowItems
(
RightsSettingTitle
rightsSettingTitle
,
List
<
RightsNowItem
>
nowItems
,
RightsNowItemType
itemType
,
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
Integer
top
)
{
List
<
RightsNowItem
>
items
=
Lists
.
newArrayList
();
if
(
CollectionUtils
.
isEmpty
(
nowItems
))
{
// 填充咨询
supplementNews
(
rightsSettingId
,
wechatUserId
,
rightsClassifyId
,
top
,
items
);
rightsSettingTitle
.
setRightsSettingItemList
(
items
);
return
;
}
// 处理权益中的应用/作品
fillProductAndApp
(
nowItems
);
//移除不能购买的应用或作品
removeCanNotBuy
(
nowItems
);
for
(
RightsNowItem
nowItem
:
nowItems
)
{
if
(
itemType
.
value
.
equals
(
nowItem
.
getType
()))
{
items
.
add
(
nowItem
);
}
}
if
(
items
.
size
()
<
top
)
{
// 填充咨询
supplementNews
(
rightsSettingId
,
wechatUserId
,
rightsClassifyId
,
top
,
items
);
}
rightsSettingTitle
.
setRightsSettingItemList
(
items
);
}
/**
* @Author David
* @Description 补充咨询
* @Date 2020/4/25 12:20
* @Param [rightsSettingId, wechatUserId, rightsClassifyId, top, items]
* @return void
**/
private
void
supplementNews
(
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
Integer
top
,
List
<
RightsNowItem
>
items
)
{
FillRightsSettingAppletsDTO
applets
=
getFillRightsSettingApplets
(
rightsSettingId
,
wechatUserId
,
rightsClassifyId
,
top
);
List
<
AppletNews
>
news
=
applets
.
getDesignatedNews
();
for
(
AppletNews
appletNews
:
news
)
{
items
.
add
(
RightsNowItem
.
builder
().
serveId
(
appletNews
.
getId
()).
serveName
(
appletNews
.
getNewsName
()).
serveTypeName
(
"资讯"
).
servePic
(
appletNews
.
getPic1
()).
type
(
0
).
build
());
}
}
@Deprecated
@ParamLog
(
"填充资源"
)
private
void
fillRightsNowItems
(
RightsSetting
rightsSetting
)
{
List
<
Integer
>
types
=
new
ArrayList
<>();
...
...
@@ -342,19 +520,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
List
<
RightsNowItem
>
nowItems
=
rightsNowItemDao
.
getListByRightsSettingId
(
rightsSetting
.
getId
(),
types
);
if
(!
ListUtils
.
isEmpty
(
nowItems
))
{
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
appIds
=
new
ArrayList
<>();
for
(
RightsNowItem
item
:
nowItems
)
{
if
(
item
.
getServeId
()
!=
null
&&
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
item
.
getServeType
())
&&
!
productIds
.
contains
(
item
.
getServeId
()))
{
productIds
.
add
(
item
.
getServeId
());
}
if
(
item
.
getServeId
()
!=
null
&&
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
item
.
getServeType
())
&&
!
productIds
.
contains
(
item
.
getServeId
()))
{
appIds
.
add
(
item
.
getServeId
());
}
}
fillProductAndApp
(
nowItems
,
productIds
,
appIds
);
fillProductAndApp
(
nowItems
);
rightsSettingTitler4Online
.
setRightsSettingItemList
(
nowItems
.
stream
().
filter
(
s
->
RightsNowItemType
.
ONLINE_COURSE
.
value
.
equals
(
s
.
getType
())).
collect
(
Collectors
.
toList
()));
rightsSettingTitler4Learningtool
.
setRightsSettingItemList
(
...
...
@@ -370,12 +536,27 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSetting
.
setGiftCouponPackageTitle
(
null
==
rightsSettingTitleMap
.
get
(
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
)
?
new
RightsSettingTitle
()
:
rightsSettingTitleMap
.
get
(
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
));
rightsSetting
.
setServesTitle
(
null
==
rightsSettingTitleMap
.
get
(
RightsNowItemType
.
SERVES
.
value
)
?
rightsSettingTitler4Serves:
rightsSettingTitleMap
.
get
(
RightsNowItemType
.
SERVES
.
value
));
rightsSettingTitler4Serves
:
rightsSettingTitleMap
.
get
(
RightsNowItemType
.
SERVES
.
value
));
}
private
void
fillProductAndApp
(
List
<
RightsNowItem
>
nowItems
,
List
<
Long
>
productIds
,
List
<
Long
>
appIds
)
{
private
void
fillProductAndApp
(
List
<
RightsNowItem
>
nowItems
)
{
log
.
info
(
"即享权益填充产品和app内容"
);
if
(
ListUtils
.
isEmpty
(
nowItems
)){
return
;
}
List
<
Long
>
productIds
=
new
ArrayList
<>();
List
<
Long
>
appIds
=
new
ArrayList
<>();
for
(
RightsNowItem
item
:
nowItems
)
{
if
(
item
.
getServeId
()
!=
null
&&
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
item
.
getServeType
())
&&
!
productIds
.
contains
(
item
.
getServeId
()))
{
productIds
.
add
(
item
.
getServeId
());
}
if
(
item
.
getServeId
()
!=
null
&&
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
item
.
getServeType
())
&&
!
productIds
.
contains
(
item
.
getServeId
()))
{
appIds
.
add
(
item
.
getServeId
());
}
}
Map
<
Long
,
ProductDto
>
productDtoMap
=
new
HashMap
<>();
Map
<
Long
,
AppDto
>
appDtoMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
productIds
))
{
...
...
@@ -388,7 +569,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
Integer
type
=
item
.
getType
();
if
(
RightsNowItemType
.
ONLINE_COURSE
.
value
.
equals
(
type
)
||
RightsNowItemType
.
LEARNING_TOOL
.
value
.
equals
(
type
)
||
RightsNowItemType
.
DRAW
.
value
.
equals
(
type
))
{
||
RightsNowItemType
.
DRAW
.
value
.
equals
(
type
)
||
RightsNowItemType
.
SERVES
.
value
.
equals
(
type
))
{
AccountSettingDto
accountSettingDto
;
if
(
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
item
.
getServeType
()))
{
ProductDto
productDto
=
productDtoMap
.
get
(
item
.
getServeId
());
...
...
@@ -434,36 +616,41 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
}
}
private
void
fillGiftCouponPack
(
RightsSetting
rightsSetting
)
{
private
void
fillGiftCouponPack
(
RightsSetting
rightsSetting
)
{
List
<
RightsNowItem
>
giftCouponPackItems
=
rightsNowItemDao
.
getGiftCouponListByRightsSettingId
(
rightsSetting
.
getId
());
RightsSettingTitle
rightsSettingTitler4Gift
=
new
RightsSettingTitle
();
if
(
null
!=
rightsSetting
.
getGiftCouponPackageTitle
()){
rightsSettingTitler4Gift
=
rightsSetting
.
getGiftCouponPackageTitle
();
RightsSettingTitle
rightsSettingTitle
=
getRightsSettingTitle
(
rightsSetting
,
RightsNowItemType
.
GIFT_COUPON_PACKAGE
);
if
(
null
!=
rightsSetting
.
getGiftCouponPackageTitle
())
{
// 礼券包默认开启
rightsSettingTitle
.
setOpenState
(
true
);
rightsSetting
.
setGiftCouponPackageTitle
(
rightsSettingTitle
);
rightsSettingTitle
=
rightsSetting
.
getGiftCouponPackageTitle
();
}
rightsSettingTitle
r4Gift
.
setRightsSettingItemList
(
giftCouponPackItems
);
rightsSetting
.
setGiftCouponPackageTitle
(
rightsSettingTitle
r4Gift
);
rightsSettingTitle
.
setRightsSettingItemList
(
giftCouponPackItems
);
rightsSetting
.
setGiftCouponPackageTitle
(
rightsSettingTitle
);
}
@Override
@ParamLog
(
value
=
"获取权益分类分页列表"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"获取权益分类分页列表"
,
isAfterReturn
=
false
)
public
PageBeanNew
<
RightsSettingDto
>
listRightsSettingPage
(
Integer
currentPage
,
Integer
numPerPage
,
RightsSetting
rightsSetting
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(
null
!=
rightsSetting
.
getFirstClassify
()){
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
if
(
null
!=
rightsSetting
.
getFirstClassify
())
{
setClassifyAndLabel
(
rightsSetting
);
}
paramMap
.
put
(
"rightsSettingType"
,
rightsSetting
.
getRightsSettingType
());
PageBeanNew
<
RightsSettingDto
>
rightsSettingDtoPageBeanNew
;
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
//书刊权益
paramMap
.
put
(
"bookQuery"
,
rightsSetting
.
getBookQuery
());
rightsSettingDtoPageBeanNew
=
rightsSettingDAO
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listBookRightsSettingPage"
);
}
else
{
paramMap
.
put
(
"firstClassify"
,
rightsSetting
.
getFirstClassify
());
paramMap
.
put
(
"secondClassify"
,
rightsSetting
.
getSecondClassify
());
paramMap
.
put
(
"gradeLabelId"
,
rightsSetting
.
getGradeLabelId
());
paramMap
.
put
(
"subjectLabelId"
,
rightsSetting
.
getSubjectLabelId
());
rightsSettingDtoPageBeanNew
=
rightsSettingDAO
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listRightsSettingPage"
);
}
if
(
null
!=
rightsSettingDtoPageBeanNew
&&
!
ListUtils
.
isEmpty
(
rightsSettingDtoPageBeanNew
.
getRecordList
())){
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
//书刊权益
paramMap
.
put
(
"bookQuery"
,
rightsSetting
.
getBookQuery
());
rightsSettingDtoPageBeanNew
=
rightsSettingDAO
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listBookRightsSettingPage"
);
}
else
{
paramMap
.
put
(
"firstClassify"
,
rightsSetting
.
getFirstClassify
());
paramMap
.
put
(
"secondClassify"
,
rightsSetting
.
getSecondClassify
());
paramMap
.
put
(
"gradeLabelId"
,
rightsSetting
.
getGradeLabelId
());
paramMap
.
put
(
"subjectLabelId"
,
rightsSetting
.
getSubjectLabelId
());
rightsSettingDtoPageBeanNew
=
rightsSettingDAO
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"listRightsSettingPage"
);
}
if
(
null
!=
rightsSettingDtoPageBeanNew
&&
!
ListUtils
.
isEmpty
(
rightsSettingDtoPageBeanNew
.
getRecordList
()))
{
List
<
RightsSettingDto
>
rightsSettingDtos
=
rightsSettingDtoPageBeanNew
.
getRecordList
();
setLabelContent
(
rightsSettingDtos
);
}
...
...
@@ -473,50 +660,50 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private
void
setLabelContent
(
List
<
RightsSettingDto
>
rightsSettingDtos
)
{
log
.
info
(
"权益设置标签具体内容"
);
if
(
ListUtils
.
isEmpty
(
rightsSettingDtos
)){
if
(
ListUtils
.
isEmpty
(
rightsSettingDtos
))
{
return
;
}
List
<
Long
>
firstClassifyIds
=
new
ArrayList
<>()
;
List
<
Long
>
secondClassifyIds
=
new
ArrayList
<>()
;
List
<
Long
>
firstClassifyIds
;
List
<
Long
>
secondClassifyIds
;
List
<
Long
>
classifyIds
=
new
ArrayList
<>();
List
<
Long
>
gradeLabelIds
=
new
ArrayList
<>()
;
List
<
Long
>
subjectLabelIds
=
new
ArrayList
<>()
;
List
<
Long
>
gradeLabelIds
;
List
<
Long
>
subjectLabelIds
;
List
<
Long
>
labelIds
=
new
ArrayList
<>();
firstClassifyIds
=
rightsSettingDtos
.
stream
().
map
(
e
->
e
.
getFirstClassify
()
).
collect
(
Collectors
.
toList
());
secondClassifyIds
=
rightsSettingDtos
.
stream
().
map
(
e
->
e
.
getSecondClassify
()
).
collect
(
Collectors
.
toList
());
gradeLabelIds
=
rightsSettingDtos
.
stream
().
map
(
e
->
e
.
getGradeLabelId
()
).
collect
(
Collectors
.
toList
());
subjectLabelIds
=
rightsSettingDtos
.
stream
().
map
(
e
->
e
.
getSubjectLabelId
()
).
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
firstClassifyIds
)){
firstClassifyIds
=
rightsSettingDtos
.
stream
().
map
(
RightsSetting:
:
getFirstClassify
).
collect
(
Collectors
.
toList
());
secondClassifyIds
=
rightsSettingDtos
.
stream
().
map
(
RightsSetting:
:
getSecondClassify
).
collect
(
Collectors
.
toList
());
gradeLabelIds
=
rightsSettingDtos
.
stream
().
map
(
RightsSetting:
:
getGradeLabelId
).
collect
(
Collectors
.
toList
());
subjectLabelIds
=
rightsSettingDtos
.
stream
().
map
(
RightsSetting:
:
getSubjectLabelId
).
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
firstClassifyIds
))
{
classifyIds
.
addAll
(
firstClassifyIds
);
}
if
(!
ListUtils
.
isEmpty
(
secondClassifyIds
)){
if
(!
ListUtils
.
isEmpty
(
secondClassifyIds
))
{
classifyIds
.
addAll
(
secondClassifyIds
);
}
if
(!
ListUtils
.
isEmpty
(
gradeLabelIds
)){
if
(!
ListUtils
.
isEmpty
(
gradeLabelIds
))
{
labelIds
.
addAll
(
gradeLabelIds
);
}
if
(!
ListUtils
.
isEmpty
(
subjectLabelIds
)){
if
(!
ListUtils
.
isEmpty
(
subjectLabelIds
))
{
labelIds
.
addAll
(
subjectLabelIds
);
}
Map
<
Long
,
AssistTempletDTO
>
classifyMap
=
new
HashMap
<>();
Map
<
Long
,
BookLabel
>
labelMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
classifyIds
)){
Map
<
Long
,
BookLabel
>
labelMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
classifyIds
))
{
classifyMap
=
assistTempletConsr
.
mapByIds4Classify
(
classifyIds
);
}
if
(!
ListUtils
.
isEmpty
(
labelIds
)){
if
(!
ListUtils
.
isEmpty
(
labelIds
))
{
labelMap
=
bookLabelDao
.
getMapByIds
(
labelIds
);
}
for
(
RightsSettingDto
rightsSettingDto
:
rightsSettingDtos
)
{
if
(!
MapUtils
.
isEmpty
(
classifyMap
)
&&
classifyMap
.
containsKey
(
rightsSettingDto
.
getFirstClassify
()))
{
for
(
RightsSettingDto
rightsSettingDto
:
rightsSettingDtos
)
{
if
(!
MapUtils
.
isEmpty
(
classifyMap
)
&&
classifyMap
.
containsKey
(
rightsSettingDto
.
getFirstClassify
()))
{
rightsSettingDto
.
setFirstClassifyContent
(
classifyMap
.
get
(
rightsSettingDto
.
getFirstClassify
()).
getTempletName
());
}
if
(!
MapUtils
.
isEmpty
(
classifyMap
)
&&
classifyMap
.
containsKey
(
rightsSettingDto
.
getSecondClassify
()))
{
if
(!
MapUtils
.
isEmpty
(
classifyMap
)
&&
classifyMap
.
containsKey
(
rightsSettingDto
.
getSecondClassify
()))
{
rightsSettingDto
.
setSecondClassifyContent
(
classifyMap
.
get
(
rightsSettingDto
.
getSecondClassify
()).
getTempletName
());
}
if
(!
MapUtils
.
isEmpty
(
labelMap
)
&&
labelMap
.
containsKey
(
rightsSettingDto
.
getGradeLabelId
()))
{
if
(!
MapUtils
.
isEmpty
(
labelMap
)
&&
labelMap
.
containsKey
(
rightsSettingDto
.
getGradeLabelId
()))
{
rightsSettingDto
.
setGradeLabelIdContent
(
labelMap
.
get
(
rightsSettingDto
.
getGradeLabelId
()).
getName
());
}
if
(!
MapUtils
.
isEmpty
(
labelMap
)
&&
labelMap
.
containsKey
(
rightsSettingDto
.
getSubjectLabelId
()))
{
if
(!
MapUtils
.
isEmpty
(
labelMap
)
&&
labelMap
.
containsKey
(
rightsSettingDto
.
getSubjectLabelId
()))
{
rightsSettingDto
.
setSubjectLabelIdContent
(
labelMap
.
get
(
rightsSettingDto
.
getSubjectLabelId
()).
getName
());
}
}
...
...
@@ -525,33 +712,32 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Override
public
RightsSettingDto
getByLabel
(
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLabelId
)
{
//医疗保健分类校验
if
(
ArrayUtils
.
contains
(
RightsSettingConstant
.
MEDICAL_INSURANCE_TEMPLET_ID
,
firstClassify
))
{
subjectLabelId
=
null
;
gradeLabelId
=
null
;
if
(
ArrayUtils
.
contains
(
RightsSettingConstant
.
MEDICAL_INSURANCE_TEMPLET_ID
,
firstClassify
))
{
subjectLabelId
=
null
;
gradeLabelId
=
null
;
}
//k12教育分类校验
else
if
(
"test"
.
equals
(
envStr
)
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
K12_TEMPLET_ID_TEST
,
firstClassify
)){
secondClassify
=
null
;
}
else
if
(!
"test"
.
equals
(
envStr
)
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
K12_TEMPLET_ID
,
firstClassify
)){
secondClassify
=
null
;
}
else
{
secondClassify
=
null
;
subjectLabelId
=
null
;
gradeLabelId
=
null
;
else
if
(
"test"
.
equals
(
envStr
)
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
K12_TEMPLET_ID_TEST
,
firstClassify
))
{
secondClassify
=
null
;
}
else
if
(!
"test"
.
equals
(
envStr
)
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
K12_TEMPLET_ID
,
firstClassify
))
{
secondClassify
=
null
;
}
else
{
secondClassify
=
null
;
subjectLabelId
=
null
;
gradeLabelId
=
null
;
}
RightsSettingDto
dto
=
rightsSettingDAO
.
getByLabel
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
);
RightsSettingDto
dto
=
rightsSettingDAO
.
getByLabel
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
);
return
dto
;
}
@Override
public
Integer
getUserCount
()
{
Integer
userCount
=
102336
;
String
key
=
"BOOK:APPLET:RIGHTS_SETTING_USER_COUNT"
;
String
key
=
"BOOK:APPLET:RIGHTS_SETTING_USER_COUNT"
;
String
value
=
JedisClusterUtils
.
get
(
key
);
if
(
StringUtil
.
isEmpty
(
value
)){
JedisClusterUtils
.
set
(
key
,
userCount
.
toString
(),
24
*
3600
);
}
else
{
if
(
StringUtil
.
isEmpty
(
value
))
{
JedisClusterUtils
.
set
(
key
,
userCount
.
toString
(),
24
*
3600
);
}
else
{
userCount
=
Integer
.
valueOf
(
value
);
}
return
userCount
;
...
...
@@ -559,12 +745,12 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Override
public
void
batchInsertRightsSettingItem
(
List
<
RightsSettingItem
>
rightsSettingItemList
,
Long
rightsSettingId
,
String
rightsType
)
{
if
(
null
==
rightsSettingId
||
StringUtil
.
isEmpty
(
rightsType
))
{
if
(
null
==
rightsSettingId
||
StringUtil
.
isEmpty
(
rightsType
))
{
return
;
}
rightsSettingItemDao
.
deleteByRightsSettingId
(
rightsSettingId
,
rightsType
);
if
(!
ListUtils
.
isEmpty
(
rightsSettingItemList
)){
for
(
RightsSettingItem
rightsSettingItem
:
rightsSettingItemList
)
{
rightsSettingItemDao
.
deleteByRightsSettingId
(
rightsSettingId
,
rightsType
);
if
(!
ListUtils
.
isEmpty
(
rightsSettingItemList
))
{
for
(
RightsSettingItem
rightsSettingItem
:
rightsSettingItemList
)
{
rightsSettingItem
.
setRightsSettingId
(
rightsSettingId
);
rightsSettingItem
.
setRightsType
(
rightsType
);
}
...
...
@@ -585,15 +771,15 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
public
RightsSettingDto
getRightsSettingByBookId4AppletHome
(
Long
bookId
,
Long
adviserId
,
Long
channelId
)
{
//根据书获取权益
RightsSettingDto
rightsSettingDto
=
rightsSettingDAO
.
getByBookId
(
bookId
);
if
(
null
==
rightsSettingDto
)
{
if
(
null
==
rightsSettingDto
)
{
//根据分类获取权益
BookAdviserDto
adviserDto
=
bookAdviserBiz
.
getBase
(
bookId
,
channelId
,
adviserId
);
if
(
null
!=
adviserDto
)
{
rightsSettingDto
=
getByLabel
(
adviserDto
.
getTempletId
(),
adviserDto
.
getSecondTempletId
(),
adviserDto
.
getGraLabelId
(),
adviserDto
.
getSubLabelId
());
BookAdviserDto
adviserDto
=
bookAdviserBiz
.
getBase
(
bookId
,
channelId
,
adviserId
);
if
(
null
!=
adviserDto
)
{
rightsSettingDto
=
getByLabel
(
adviserDto
.
getTempletId
(),
adviserDto
.
getSecondTempletId
(),
adviserDto
.
getGraLabelId
(),
adviserDto
.
getSubLabelId
());
}
}
if
(
null
==
rightsSettingDto
)
{
log
.
error
(
"该书没有匹配的分类权益,bookId="
+
bookId
);
if
(
null
==
rightsSettingDto
)
{
log
.
error
(
"该书没有匹配的分类权益,bookId="
+
bookId
);
return
new
RightsSettingDto
();
}
return
rightsSettingDto
;
...
...
@@ -601,26 +787,26 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Override
@ParamLog
(
value
=
"小程序首页本周/长期权益查询"
,
isAfterReturn
=
false
)
public
RightsSettingDto
getItemByRightsSettingId4AppletHome
(
Long
rightsSettingId
,
Long
wechatUserId
,
String
rightsType
){
public
RightsSettingDto
getItemByRightsSettingId4AppletHome
(
Long
rightsSettingId
,
Long
wechatUserId
,
String
rightsType
)
{
RightsSettingDto
rightsSettingDto
=
new
RightsSettingDto
();
//每周/长期权益
if
(
RightsTypeEnum
.
WEEK
.
value
.
equals
(
rightsType
)){
if
(
RightsTypeEnum
.
WEEK
.
value
.
equals
(
rightsType
))
{
rightsSettingDto
.
setRightsSettingWeekItems
(
getItemsByRightsSettingId4Applet
(
rightsSettingId
,
RightsTypeEnum
.
WEEK
.
value
,
wechatUserId
));
}
else
if
(
RightsTypeEnum
.
LONG_TERM
.
value
.
equals
(
rightsType
)){
rightsSettingDto
.
setRightsSettingLongTermItems
(
getItemsByRightsSettingId4Applet
(
rightsSettingId
,
RightsTypeEnum
.
LONG_TERM
.
value
,
wechatUserId
));
}
else
if
(
RightsTypeEnum
.
LONG_TERM
.
value
.
equals
(
rightsType
))
{
rightsSettingDto
.
setRightsSettingLongTermItems
(
getItemsByRightsSettingId4Applet
(
rightsSettingId
,
RightsTypeEnum
.
LONG_TERM
.
value
,
wechatUserId
));
}
return
rightsSettingDto
;
}
@Override
public
List
<
RightsSettingItem
>
getItemsByRightsSettingId4Applet
(
Long
rightsSettingId
,
String
rightsType
,
Long
wechatUserId
){
List
<
RightsSettingItem
>
list
=
getItemsByRightsSettingId
(
rightsSettingId
,
rightsType
);
if
(
ListUtils
.
isEmpty
(
list
)){
public
List
<
RightsSettingItem
>
getItemsByRightsSettingId4Applet
(
Long
rightsSettingId
,
String
rightsType
,
Long
wechatUserId
)
{
List
<
RightsSettingItem
>
list
=
getItemsByRightsSettingId
(
rightsSettingId
,
rightsType
);
if
(
ListUtils
.
isEmpty
(
list
))
{
return
new
ArrayList
<>();
}
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
//书刊权益,分类标签从编辑书刊取
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
//书刊权益,分类标签从编辑书刊取
BookAdviserDto
adviserDto
=
bookAdviserBiz
.
getOneMainBook
(
rightsSetting
.
getBookId
());
rightsSetting
.
setFirstClassify
(
adviserDto
.
getTempletId
());
rightsSetting
.
setSecondClassify
(
adviserDto
.
getSecondTempletId
());
...
...
@@ -628,34 +814,34 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
rightsSetting
.
setSubjectLabelId
(
adviserDto
.
getSubLabelId
());
}
//匹配资讯
List
<
AppletNewsDTO
>
appletNewsDTOS
=
appletNewsBiz
.
getNewsByTempletLabel
(
rightsSetting
.
getFirstClassify
(),
rightsSetting
.
getSecondClassify
(),
rightsSetting
.
getGradeLabelId
(),
rightsSetting
.
getSubjectLabelId
(),
rightsType
);
if
(
ListUtils
.
isEmpty
(
appletNewsDTOS
)){
List
<
AppletNewsDTO
>
appletNewsDTOS
=
appletNewsBiz
.
getNewsByTempletLabel
(
rightsSetting
.
getFirstClassify
(),
rightsSetting
.
getSecondClassify
(),
rightsSetting
.
getGradeLabelId
(),
rightsSetting
.
getSubjectLabelId
(),
rightsType
);
if
(
ListUtils
.
isEmpty
(
appletNewsDTOS
))
{
//没有则根据书刊分类和标签获取
appletNewsDTOS
=
appletNewsBiz
.
getNewsByTempletLabel
(
rightsSetting
.
getFirstClassify
(),
rightsSetting
.
getSecondClassify
(),
rightsSetting
.
getGradeLabelId
(),
rightsSetting
.
getSubjectLabelId
(),
null
);
if
(
ListUtils
.
isEmpty
(
appletNewsDTOS
)){
appletNewsDTOS
=
appletNewsBiz
.
getNewsByTempletLabel
(
rightsSetting
.
getFirstClassify
(),
rightsSetting
.
getSecondClassify
(),
rightsSetting
.
getGradeLabelId
(),
rightsSetting
.
getSubjectLabelId
(),
null
);
if
(
ListUtils
.
isEmpty
(
appletNewsDTOS
))
{
return
list
;
}
}
Map
<
Long
,
List
<
AppletNewsDTO
>>
map
=
appletNewsDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
AppletNewsDTO:
:
getRightsClassifyId
));
for
(
RightsSettingItem
item
:
list
)
{
for
(
RightsSettingItem
item
:
list
)
{
//用户-权益-权益分类
String
key
=
"BOOK:RIGHTS_SETTING:USER_RIGHTS_ITEM"
+
wechatUserId
+
"-"
+
rightsSettingId
+
"-"
+
item
.
getRightsClassifyId
();
String
key
=
"BOOK:RIGHTS_SETTING:USER_RIGHTS_ITEM"
+
wechatUserId
+
"-"
+
rightsSettingId
+
"-"
+
item
.
getRightsClassifyId
();
//权益分类下资讯
List
<
AppletNewsDTO
>
newsDTOS
=
JedisClusterUtils
.
getJsonList
(
key
,
AppletNewsDTO
.
class
);
if
(
ListUtils
.
isEmpty
(
newsDTOS
)||
newsDTOS
.
size
()<
3
)
{
//数据库取
List
<
AppletNewsDTO
>
newsDTOS
=
JedisClusterUtils
.
getJsonList
(
key
,
AppletNewsDTO
.
class
);
if
(
ListUtils
.
isEmpty
(
newsDTOS
)
||
newsDTOS
.
size
()
<
3
)
{
//数据库取
if
(!
MapUtils
.
isEmpty
(
map
)
&&
map
.
containsKey
(
item
.
getRightsClassifyId
()))
{
newsDTOS
=
map
.
get
(
item
.
getRightsClassifyId
());
if
(
newsDTOS
.
size
()>
3
)
{
//随机取三条
List
<
AppletNewsDTO
>
dtos
=
new
ArrayList
<>();
while
(
dtos
.
size
()<
3
)
{
newsDTOS
=
map
.
get
(
item
.
getRightsClassifyId
());
if
(
newsDTOS
.
size
()
>
3
)
{
//随机取三条
List
<
AppletNewsDTO
>
dtos
=
new
ArrayList
<>();
while
(
dtos
.
size
()
<
3
)
{
AppletNewsDTO
dto
=
newsDTOS
.
get
(
new
Random
().
nextInt
(
newsDTOS
.
size
()));
if
(!
dtos
.
contains
(
dto
))
{
if
(!
dtos
.
contains
(
dto
))
{
dtos
.
add
(
dto
);
}
}
newsDTOS
=
dtos
;
}
JedisClusterUtils
.
setJsonList
(
key
,
newsDTOS
,
CommonUtils
.
todayRemainingSeconds
());
JedisClusterUtils
.
setJsonList
(
key
,
newsDTOS
,
CommonUtils
.
todayRemainingSeconds
());
}
}
item
.
setAppletNewsDTOS
(
newsDTOS
);
...
...
@@ -671,49 +857,77 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@ParamLog
(
"根据权益id获取即享权益项"
)
@Override
public
RightsSetting
getRightsSettingRightsNowItems
(
Long
rightsSettingId
,
Long
wechatUserId
)
{
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
if
(
rightsSetting
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"未找到权益!"
);
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
if
(
rightsSetting
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"未找到权益!"
);
}
fillRightsNowItems
(
rightsSetting
);
return
rightsSetting
;
}
@ParamLog
(
"根据权益id和类型获取即享权益项"
)
@Override
public
RightsSetting
getRightsSettingRightsNowItemsByType
(
Long
rightsSettingId
,
Long
wechatUserId
,
Integer
type
)
{
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
if
(
rightsSetting
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
ERROR
,
"未找到权益!"
);
}
// 获取抽奖权益
if
(
RightsNowItemType
.
DRAW
.
value
.
equals
(
type
))
{
return
setDraw
(
rightsSetting
,
wechatUserId
);
}
// 获取学习工具权益
if
(
RightsNowItemType
.
LEARNING_TOOL
.
value
.
equals
(
type
))
{
return
setLearningTool
(
rightsSetting
,
wechatUserId
);
}
// 获取线上网课权益
if
(
RightsNowItemType
.
ONLINE_COURSE
.
value
.
equals
(
type
))
{
return
setOnlineCourse
(
rightsSetting
,
wechatUserId
);
}
// 获取专享礼券包权益
if
(
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
.
equals
(
type
))
{
return
setGiftCouponPackage
(
rightsSetting
,
wechatUserId
);
}
return
rightsSetting
;
}
@ParamLog
(
"根据权益id获取即享权益项专享礼包"
)
@Override
public
RightsSetting
getRightsSettingGiftCoupons
(
Long
rightsSettingId
,
Long
wechatUserId
)
{
RightsSetting
rightsSetting
=
new
RightsSetting
();
RightsSetting
rightsSetting
=
new
RightsSetting
();
rightsSetting
.
setId
(
rightsSettingId
);
RightsSettingTitle
rightsSettingTitle4Gift
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightsSettingId
,
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
);
if
(
null
!=
rightsSettingTitle4Gift
){
RightsSettingTitle
rightsSettingTitle4Gift
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightsSettingId
,
RightsNowItemType
.
GIFT_COUPON_PACKAGE
.
value
);
if
(
null
!=
rightsSettingTitle4Gift
)
{
rightsSetting
.
setGiftCouponPackageTitle
(
rightsSettingTitle4Gift
);
}
fillGiftCouponPack
(
rightsSetting
);
fillUserGiftReceiveStatus
(
rightsSetting
,
wechatUserId
);
fillUserGiftReceiveStatus
(
rightsSetting
,
wechatUserId
);
return
rightsSetting
;
}
@ParamLog
(
"根据权益id获取即享权益项补充咨询"
)
@Override
public
FillRightsSettingAppletsDTO
getFillRightsSettingApplets
(
Long
rightsSettingId
,
Long
wechatUserId
)
{
if
(
rightsSettingId
==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
public
FillRightsSettingAppletsDTO
getFillRightsSettingApplets
(
Long
rightsSettingId
,
Long
wechatUserId
,
Long
rightsClassifyId
,
Integer
top
)
{
if
(
rightsSettingId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
FillRightsSettingAppletsDTO
fill
=
new
FillRightsSettingAppletsDTO
();
FillRightsSettingAppletsDTO
fill
=
new
FillRightsSettingAppletsDTO
();
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
if
(
rightsSetting
==
null
)
{
if
(
rightsSetting
==
null
)
{
return
fill
;
}
Long
firstClassify
=
rightsSetting
.
getFirstClassify
();
Long
firstClassify
=
rightsSetting
.
getFirstClassify
();
Long
secondClassify
=
rightsSetting
.
getSecondClassify
();
Long
gradeLabelId
=
null
;
Long
subjectLabelId
=
null
;
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
//书刊权益,分类标签从编辑书刊取
Long
gradeLabelId
=
null
;
Long
subjectLabelId
=
null
;
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
//书刊权益,分类标签从编辑书刊取
BookAdviserDto
adviserDto
=
bookAdviserBiz
.
getOneMainBook
(
rightsSetting
.
getBookId
());
firstClassify
=
adviserDto
.
getTempletId
();
secondClassify
=
adviserDto
.
getSecondTempletId
();
gradeLabelId
=
adviserDto
.
getGraLabelId
();
subjectLabelId
=
adviserDto
.
getSubLabelId
();
firstClassify
=
adviserDto
.
getTempletId
();
secondClassify
=
adviserDto
.
getSecondTempletId
();
gradeLabelId
=
adviserDto
.
getGraLabelId
();
subjectLabelId
=
adviserDto
.
getSubLabelId
();
}
BaseTempletClassify
classify
=
new
BaseTempletClassify
();
classify
.
setFirstClassify
(
firstClassify
);
...
...
@@ -721,40 +935,142 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
classify
.
setGradeLabelId
(
gradeLabelId
);
classify
.
setSubjectLabelId
(
subjectLabelId
);
setClassifyAndLabel
(
classify
);
firstClassify
=
classify
.
getFirstClassify
();
secondClassify
=
classify
.
getSecondClassify
();
gradeLabelId
=
classify
.
getGradeLabelId
();
subjectLabelId
=
classify
.
getSubjectLabelId
();
fill
.
setFillServes
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
1L
,
4
));
fill
.
setFillOnlineCourses
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
2L
,
3
));
fill
.
setFillLearningTools
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
3L
,
1
));
fill
.
setFillDraws
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
4L
,
1
));
fill
.
setFillGiftCouponPackages
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
5L
,
4
));
fill
.
setFillGroups
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
6L
,
1
));
firstClassify
=
classify
.
getFirstClassify
();
secondClassify
=
classify
.
getSecondClassify
();
gradeLabelId
=
classify
.
getGradeLabelId
();
subjectLabelId
=
classify
.
getSubjectLabelId
();
if
(
Objects
.
isNull
(
rightsClassifyId
))
{
fill
.
setFillServes
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
1L
,
4
));
fill
.
setFillOnlineCourses
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
2L
,
3
));
fill
.
setFillLearningTools
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
3L
,
1
));
fill
.
setFillDraws
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
4L
,
1
));
fill
.
setFillGiftCouponPackages
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
5L
,
4
));
fill
.
setFillGroups
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
6L
,
1
));
}
else
{
fill
.
setDesignatedNews
(
getAppletItems
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
rightsClassifyId
,
top
));
}
return
fill
;
}
private
List
<
AppletNews
>
getAppletItems
(
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLabelId
,
Long
rightsClassifyId
,
Integer
top
){
List
<
AppletNews
>
appletNews
=
appletNewsDao
.
getByTempletAndClassify
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
rightsClassifyId
,
top
);
if
(
ListUtils
.
isEmpty
(
appletNews
)){
@ParamLog
(
"根据权益id获取即享权益配套资料分组集合"
)
@Override
public
List
<
RightsItemGroup
>
getRightsItemGroups
(
Long
rightsSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Boolean
removeCanNotBuy
)
{
if
(
rightsSettingId
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数有误!"
);
}
List
<
RightsItemGroup
>
groups
=
rightsItemGroupDao
.
getListByRightSettingId
(
rightsSettingId
);
if
(
ListUtils
.
isEmpty
(
groups
))
{
return
groups
;
}
List
<
Long
>
groupIds
=
new
ArrayList
<>();
List
<
RightsItemGroup
>
originals
=
new
ArrayList
<>();
List
<
RightsNowItem
>
nowItems
=
new
ArrayList
<>();
for
(
RightsItemGroup
group:
groups
){
if
(
group
.
getShowState
()
==
null
||
group
.
getShowState
()){
groupIds
.
add
(
group
.
getId
());
if
(
RightsItemGroupType
.
ORIGINAL
.
value
.
equals
(
group
.
getType
())){
originals
.
add
(
group
);
}
}
List
<
String
>
descList
=
new
ArrayList
<>();
if
(!
StringUtil
.
isEmpty
(
group
.
getDesc1
())){
descList
.
add
(
group
.
getDesc1
());
}
if
(!
StringUtil
.
isEmpty
(
group
.
getDesc2
())){
descList
.
add
(
group
.
getDesc2
());
}
if
(!
StringUtil
.
isEmpty
(
group
.
getDesc3
())){
descList
.
add
(
group
.
getDesc3
());
}
group
.
setDescList
(
descList
);
}
if
(!
ListUtils
.
isEmpty
(
groupIds
)){
nowItems
=
rightsNowItemDao
.
getListByGroupIds
(
groupIds
);
if
(
nowItems
==
null
)
{
nowItems
=
new
ArrayList
<>();
}
}
if
(!
ListUtils
.
isEmpty
(
originals
)
&&
adviserId
!=
null
&&
bookId
!=
null
&&
channelId
!=
null
)
{
//获取原有的资源
RightsItemGroup
originalGroup
=
originals
.
get
(
0
);
List
<
RightsNowItem
>
originalItems
=
getOriginalItems
(
originalGroup
.
getId
(),
adviserId
,
bookId
,
channelId
,
rightsSettingId
);
nowItems
.
addAll
(
originalItems
);
}
//填充应用和作品
fillProductAndApp
(
nowItems
);
if
(
removeCanNotBuy
!=
null
&&
removeCanNotBuy
)
{
//移除不能购买的应用或作品
removeCanNotBuy
(
nowItems
);
}
Map
<
Long
,
List
<
RightsNowItem
>>
itemMap
=
nowItems
.
stream
().
collect
(
Collectors
.
groupingBy
(
RightsNowItem:
:
getRightsItemGroupId
));
for
(
RightsItemGroup
group
:
groups
)
{
group
.
setRightsNowItems
(
itemMap
.
get
(
group
.
getId
()));
}
return
groups
;
}
@ParamLog
(
"移除不能购买的应用或作品"
)
private
void
removeCanNotBuy
(
List
<
RightsNowItem
>
nowItems
)
{
if
(
ListUtils
.
isEmpty
(
nowItems
))
{
return
;
}
List
<
RightsNowItem
>
toRemoveList
=
new
ArrayList
<>();
for
(
RightsNowItem
item
:
nowItems
)
{
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
item
.
getServeType
())
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
APPLET_APP_NOT_SUPPORT
,
item
.
getServeTypeCode
())
||
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
item
.
getServeType
())
&&
ArrayUtils
.
contains
(
RightsSettingConstant
.
APPLET_PRODUCT_NOT_SUPPORT
,
item
.
getServeTypeCode
()))
{
toRemoveList
.
add
(
item
);
}
}
if
(!
ListUtils
.
isEmpty
(
toRemoveList
))
{
nowItems
.
removeAll
(
toRemoveList
);
}
}
@ParamLog
(
"获取原有配套资料"
)
private
List
<
RightsNowItem
>
getOriginalItems
(
Long
originalGroupId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
,
Long
rightsSettingId
)
{
List
<
RightsNowItem
>
nowItems
=
new
ArrayList
<>();
if
(
originalGroupId
==
null
||
rightsSettingId
==
null
){
return
nowItems
;
}
List
<
BookServeDTO
>
bookServeVOS
=
bookGroupBiz
.
getBookAndBookGroupServeIds
(
adviserId
,
bookId
,
channelId
);
if
(!
ListUtils
.
isEmpty
(
bookServeVOS
))
{
for
(
BookServeDTO
vo
:
bookServeVOS
)
{
RightsNowItem
item
=
new
RightsNowItem
();
item
.
setRightsSettingId
(
rightsSettingId
);
item
.
setRightsItemGroupId
(
originalGroupId
);
item
.
setType
(
RightsNowItemType
.
SERVES
.
value
);
item
.
setServeId
(
vo
.
getServeId
());
item
.
setServeType
(
vo
.
getTypeCode
());
item
.
setLinkUrl
(
vo
.
getUrl
());
nowItems
.
add
(
item
);
}
}
return
nowItems
;
}
private
List
<
AppletNews
>
getAppletItems
(
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLabelId
,
Long
rightsClassifyId
,
Integer
top
)
{
List
<
AppletNews
>
appletNews
=
appletNewsDao
.
getByTempletAndClassify
(
firstClassify
,
secondClassify
,
gradeLabelId
,
subjectLabelId
,
rightsClassifyId
,
top
);
if
(
ListUtils
.
isEmpty
(
appletNews
))
{
return
new
ArrayList
<>();
}
return
appletNews
;
}
@ParamLog
(
"用户是否领取专享礼包券"
)
private
void
fillUserGiftReceiveStatus
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
if
(
rightsSetting
==
null
||
wechatUserId
==
null
||
ListUtils
.
isEmpty
(
rightsSetting
.
getGiftCouponPackageTitle
().
getRightsSettingItemList
()))
{
private
void
fillUserGiftReceiveStatus
(
RightsSetting
rightsSetting
,
Long
wechatUserId
)
{
if
(
rightsSetting
==
null
||
wechatUserId
==
null
||
ListUtils
.
isEmpty
(
rightsSetting
.
getGiftCouponPackageTitle
().
getRightsSettingItemList
()))
{
return
;
}
List
<
Long
>
list
=
giftReceiveDao
.
getUserReceiveGiftId
(
wechatUserId
);
if
(
ListUtils
.
isEmpty
(
list
)){
list
=
new
ArrayList
<>();
if
(
ListUtils
.
isEmpty
(
list
))
{
list
=
new
ArrayList
<>();
}
for
(
RightsNowItem
item
:
rightsSetting
.
getGiftCouponPackageTitle
().
getRightsSettingItemList
())
{
if
(
list
.
contains
(
item
.
getGiftCouponPackageId
())){
for
(
RightsNowItem
item
:
rightsSetting
.
getGiftCouponPackageTitle
().
getRightsSettingItemList
())
{
if
(
list
.
contains
(
item
.
getGiftCouponPackageId
()))
{
item
.
setUserGiftReceive
(
true
);
}
else
{
}
else
{
item
.
setUserGiftReceive
(
false
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/
dao/
check/RightsSettingCheck.java
→
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/check/RightsSettingCheck.java
View file @
8e45e3a6
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
.
check
;
package
com
.
pcloud
.
book
.
rightsSetting
.
check
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.rightsSetting.entity.RightsItemGroup
;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.common.utils.ListUtils
;
...
...
@@ -38,6 +39,27 @@ public class RightsSettingCheck {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"分类为空!"
);
}
checkRightNowItem
(
rightsSetting
);
checkRightItemGroups
(
rightsSetting
);
}
private
void
checkRightItemGroups
(
RightsSetting
rightsSetting
)
{
if
(
rightsSetting
==
null
||
ListUtils
.
isEmpty
(
rightsSetting
.
getRightsItemGroups
())){
return
;
}
for
(
RightsItemGroup
group:
rightsSetting
.
getRightsItemGroups
()){
if
(
group
.
getShowState
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"分组是否显示为空!"
);
}
if
(
group
.
getType
()==
null
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"分组类型为空为空!"
);
}
if
(
StringUtil
.
isEmpty
(
group
.
getName
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"分组名称为空!"
);
}
if
(!
ListUtils
.
isEmpty
(
group
.
getRightsNowItems
())){
checkRightNowItemApp
(
group
.
getRightsNowItems
());
}
}
}
private
void
checkRightNowItem
(
RightsSetting
rightsSetting
)
{
...
...
@@ -62,11 +84,11 @@ public class RightsSettingCheck {
}
}
private
void
checkRightNowItemApp
(
List
<
RightsNowItem
>
onlineCourseNowI
tems
)
{
if
(
ListUtils
.
isEmpty
(
onlineCourseNowI
tems
)){
private
void
checkRightNowItemApp
(
List
<
RightsNowItem
>
i
tems
)
{
if
(
ListUtils
.
isEmpty
(
i
tems
)){
return
;
}
for
(
RightsNowItem
item
:
onlineCourseNowI
tems
)
{
for
(
RightsNowItem
item
:
i
tems
)
{
if
(
item
.
getServeId
()
==
null
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"作品或应用id为空!"
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/constants/RightsSettingConstant.java
View file @
8e45e3a6
package
com
.
pcloud
.
book
.
rightsSetting
.
constants
;
import
com.pcloud.common.core.constant.ProductTypeConstant
;
import
com.pcloud.common.enums.AppTypeEnum
;
public
class
RightsSettingConstant
{
/**
...
...
@@ -14,4 +17,16 @@ public class RightsSettingConstant {
* 医疗保健编辑书刊分类id
*/
public
static
final
Long
[]
MEDICAL_INSURANCE_TEMPLET_ID
=
{
63L
};
/**
*小程序不支持展示的应用类型
*/
public
static
final
String
[]
APPLET_APP_NOT_SUPPORT
=
{
AppTypeEnum
.
WISH
.
value
,
AppTypeEnum
.
KK
.
value
,
AppTypeEnum
.
INTERACT
.
value
,
AppTypeEnum
.
MEMBER
.
value
,
AppTypeEnum
.
ENROLL
.
value
};
/**
*小程序不支持展示的商品类型
*/
public
static
final
String
[]
APPLET_PRODUCT_NOT_SUPPORT
=
{
ProductTypeConstant
.
QA
,
ProductTypeConstant
.
TOOL
,
ProductTypeConstant
.
TUTORIAL
,
ProductTypeConstant
.
ATTENDANCE_TASK
,
ProductTypeConstant
.
MEMBER
,
ProductTypeConstant
.
THIRDPARTY
,
ProductTypeConstant
.
LINK
};
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsItemGroupDao.java
0 → 100644
View file @
8e45e3a6
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
;
import
com.pcloud.book.rightsSetting.entity.RightsItemGroup
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @ClassName com.pcloud.book.rightsSetting.dao.RightsItemGroupDao
* @Author ruansiyuan
* @Description 权益配套资料分组数据层
* @Date 2020/4/26 16:26
* @Version 1.0
**/
public
interface
RightsItemGroupDao
extends
BaseDao
<
RightsItemGroup
>
{
Integer
batchInsert
(
List
<
RightsItemGroup
>
list
);
void
deleteByRightsSettingId
(
Long
rightsSettingId
);
List
<
RightsItemGroup
>
getListByRightSettingId
(
Long
rightsSettingId
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsNowItemDao.java
View file @
8e45e3a6
...
...
@@ -19,4 +19,6 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> {
List
<
RightsNowItem
>
getListByRightsSettingId
(
Long
rightsSettingId
,
List
<
Integer
>
types
);
List
<
RightsNowItem
>
getGiftCouponListByRightsSettingId
(
Long
id
);
List
<
RightsNowItem
>
getListByGroupIds
(
List
<
Long
>
groupIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsItemGroupDaoImpl.java
0 → 100644
View file @
8e45e3a6
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
.
impl
;
import
com.pcloud.book.rightsSetting.dao.RightsItemGroupDao
;
import
com.pcloud.book.rightsSetting.entity.RightsItemGroup
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @ClassName com.pcloud.book.rightsSetting.dao.impl.RightsItemGroupDaoImpl
* @Author ruansiyuan
* @Description 权益配套资料分组数据实现层
* @Date 2020/4/26 16:27
* @Version 1.0
**/
@Component
(
"rightsItemGroupDao"
)
public
class
RightsItemGroupDaoImpl
extends
BaseDaoImpl
<
RightsItemGroup
>
implements
RightsItemGroupDao
{
@Override
public
Integer
batchInsert
(
List
<
RightsItemGroup
>
list
)
{
return
super
.
getSqlSession
().
insert
(
getStatement
(
"batchInsert"
),
list
);
}
@Override
public
void
deleteByRightsSettingId
(
Long
rightsSettingId
)
{
super
.
getSqlSession
().
delete
(
getStatement
(
"deleteByRightsSettingId"
),
rightsSettingId
);
}
@Override
public
List
<
RightsItemGroup
>
getListByRightSettingId
(
Long
rightsSettingId
)
{
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByRightSettingId"
),
rightsSettingId
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsNowItemDaoImpl.java
View file @
8e45e3a6
...
...
@@ -40,4 +40,11 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements
map
.
put
(
"rightsSettingId"
,
rightsSettingId
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getGiftCouponListByRightsSettingId"
),
map
);
}
@Override
public
List
<
RightsNowItem
>
getListByGroupIds
(
List
<
Long
>
groupIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"groupIds"
,
groupIds
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getListByGroupIds"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dto/FillRightsSettingAppletsDTO.java
View file @
8e45e3a6
...
...
@@ -32,4 +32,11 @@ public class FillRightsSettingAppletsDTO {
@ApiModelProperty
(
"补充社群共读"
)
private
List
<
AppletNews
>
fillGroups
;
/**
* @Author David
* @Description 当不需要全部时只获取对应资讯
* @Date 2020/4/24 16:08
**/
private
List
<
AppletNews
>
designatedNews
;
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsItemGroup.java
0 → 100644
View file @
8e45e3a6
package
com
.
pcloud
.
book
.
rightsSetting
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.List
;
/**
* @ClassName com.pcloud.book.rightsSetting.entity.RightsItemGroup
* @Author ruansiyuan
* @Description 权益配套资料分组
* @Date 2020/4/26 16:22
* @Version 1.0
**/
@ApiModel
(
"权益配套资料分组"
)
@Data
public
class
RightsItemGroup
extends
BaseEntity
{
@ApiModelProperty
(
"权益id"
)
private
Long
rightsSettingId
;
@ApiModelProperty
(
"分组名称"
)
private
String
name
;
@ApiModelProperty
(
"是否展示"
)
private
Boolean
showState
;
@ApiModelProperty
(
"类型:1本书原版资料,2自定义"
)
private
Integer
type
;
@ApiModelProperty
(
"图片"
)
private
String
pic
;
@ApiModelProperty
(
"描述1"
)
private
String
desc1
;
@ApiModelProperty
(
"描述2"
)
private
String
desc2
;
@ApiModelProperty
(
"描述3"
)
private
String
desc3
;
@ApiModelProperty
(
"描述集合"
)
private
List
<
String
>
descList
;
@ApiModelProperty
(
"应用或作品集合"
)
private
List
<
RightsNowItem
>
rightsNowItems
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsNowItem.java
View file @
8e45e3a6
...
...
@@ -2,35 +2,43 @@ package com.pcloud.book.rightsSetting.entity;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.NoArgsConstructor
;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/19 17:41
**/
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
RightsNowItem
extends
BaseEntity
{
@ApiModelProperty
(
"权益id"
)
private
Long
rightsSettingId
;
@ApiModelProperty
(
"应用
或
作品id"
)
@ApiModelProperty
(
"应用
/资讯/
作品id"
)
private
Long
serveId
;
@ApiModelProperty
(
"应用
或
作品类型"
)
@ApiModelProperty
(
"应用
/资讯/
作品类型"
)
private
String
serveType
;
@ApiModelProperty
(
"链接url"
)
private
String
linkUrl
;
@ApiModelProperty
(
"类型(
1线上网课,2学习工具,3抽奖,4专享礼包券
)"
)
@ApiModelProperty
(
"类型(
0咨询,1线上网课,2学习工具,3抽奖,4专享礼包券,6配套资料
)"
)
private
Integer
type
;
@ApiModelProperty
(
"专享礼包券id"
)
private
Long
giftCouponPackageId
;
@ApiModelProperty
(
"应用
或
作品图片"
)
@ApiModelProperty
(
"应用
/资讯/
作品图片"
)
private
String
servePic
;
@ApiModelProperty
(
"应用
或
作品名称"
)
@ApiModelProperty
(
"应用
/资讯/
作品名称"
)
private
String
serveName
;
@ApiModelProperty
(
"应用
或
作品类型名称"
)
@ApiModelProperty
(
"应用
/资讯/
作品类型名称"
)
private
String
serveTypeName
;
@ApiModelProperty
(
"应用
或
作品类型编码"
)
@ApiModelProperty
(
"应用
/资讯/
作品类型编码"
)
private
String
serveTypeCode
;
@ApiModelProperty
(
"结果链接"
)
private
String
resultUrl
;
...
...
@@ -46,6 +54,16 @@ public class RightsNowItem extends BaseEntity {
private
String
giftCouponCoverPic
;
@ApiModelProperty
(
"专享礼包券领取状态"
)
private
Boolean
userGiftReceive
;
@ApiModelProperty
(
"权益配套资料分组id"
)
private
Long
rightsItemGroupId
;
@ApiModelProperty
(
"券类型(2-书币券,1-课程券)"
)
private
Integer
couponType
;
@ApiModelProperty
(
"使用说明"
)
private
String
instructions
;
@ApiModelProperty
(
"课程券使用方式(1-链接兑取,2-复制码)"
)
private
Integer
useType
;
@ApiModelProperty
(
"兑换地址"
)
private
String
exchangeAddress
;
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsSetting.java
View file @
8e45e3a6
...
...
@@ -86,6 +86,9 @@ public class RightsSetting extends BaseTempletClassify {
*/
private
List
<
RightsSettingItem
>
rightsSettingLongTermItems
;
@ApiModelProperty
(
"权益配套资料分组集合"
)
private
List
<
RightsItemGroup
>
rightsItemGroups
;
public
RightsSetting
()
{
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/enums/RightsItemGroupType.java
0 → 100644
View file @
8e45e3a6
package
com
.
pcloud
.
book
.
rightsSetting
.
enums
;
public
enum
RightsItemGroupType
{
/**
* 1本书原配套
*/
ORIGINAL
(
1
),
/**
* 2自定义
*/
USER_DEFINED
(
2
);
/**
* 值
*/
public
final
Integer
value
;
RightsItemGroupType
(
Integer
value
)
{
this
.
value
=
value
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/enums/RightsNowItemType.java
View file @
8e45e3a6
...
...
@@ -20,11 +20,10 @@ public enum RightsNowItemType {
GIFT_COUPON_PACKAGE
(
4
),
/**
* 5
专享礼包券
* 5
社群服务
*/
GROUP_SERVICE
(
5
),
/**
* 6 配套资料
*/
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/facade/RightsSettingFacede.java
View file @
8e45e3a6
...
...
@@ -13,7 +13,6 @@ import com.pcloud.common.utils.SessionUtil;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.string.StringUtil
;
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
;
...
...
@@ -26,6 +25,11 @@ import org.springframework.web.bind.annotation.RestController;
import
java.util.List
;
import
javax.validation.constraints.Min
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.SneakyThrows
;
@RequestMapping
(
"rightsSetting"
)
@RestController
(
"rightsSettingFacede"
)
public
class
RightsSettingFacede
{
...
...
@@ -34,33 +38,33 @@ public class RightsSettingFacede {
private
RightsSettingBiz
rightsSettingBiz
;
@PostMapping
(
"addRightsSetting"
)
public
ResponseDto
<
Long
>
addRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
RightsSetting
rightsSetting
)
throws
PermissionException
{
public
ResponseDto
<
Long
>
addRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
RightsSetting
rightsSetting
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<
Long
>(
rightsSettingBiz
.
addRightsSetting
(
rightsSetting
));
}
@GetMapping
(
"deleteRightsSetting"
)
public
ResponseDto
<?>
deleteRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
throws
PermissionException
{
public
ResponseDto
<?>
deleteRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
rightsSettingBiz
.
deleteRightsSetting
(
id
);
return
new
ResponseDto
<>();
}
@PostMapping
(
"updateRightsSetting"
)
public
ResponseDto
<?>
updateRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
RightsSetting
rightsSetting
)
throws
PermissionException
{
public
ResponseDto
<?>
updateRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
RightsSetting
rightsSetting
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
rightsSettingBiz
.
updateRightsSetting
(
rightsSetting
);
return
new
ResponseDto
<>();
}
@GetMapping
(
"getRightsSetting"
)
public
ResponseDto
<
RightsSetting
>
getRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
throws
PermissionException
{
public
ResponseDto
<
RightsSetting
>
getRightsSetting
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"id"
)
Long
id
)
throws
PermissionException
{
SessionUtil
.
getToken4Redis
(
token
);
return
new
ResponseDto
<
RightsSetting
>(
rightsSettingBiz
.
getRightsSetting
(
id
));
}
@GetMapping
(
"listRightsSettingPage"
)
public
ResponseDto
<
PageBeanNew
<
RightsSettingDto
>>
listRightsSettingPage
(
@RequestHeader
(
"token"
)
String
token
,
public
ResponseDto
<
PageBeanNew
<
RightsSettingDto
>>
listRightsSettingPage
(
@RequestHeader
(
"token"
)
String
token
,
@RequestParam
(
"currentPage"
)
Integer
currentPage
,
@RequestParam
(
"numPerPage"
)
Integer
numPerPage
,
@RequestParam
(
value
=
"firstClassify"
,
required
=
false
)
Long
firstClassify
,
...
...
@@ -83,25 +87,25 @@ public class RightsSettingFacede {
@ApiOperation
(
"获取读者数量-每天自增"
)
@GetMapping
(
"getUserCount"
)
public
ResponseDto
<
Integer
>
getUserCount
(){
public
ResponseDto
<
Integer
>
getUserCount
()
{
return
new
ResponseDto
<>(
rightsSettingBiz
.
getUserCount
());
}
@ApiOperation
(
"新增每周/长期权益"
)
@PostMapping
(
"addRightsSettingItem"
)
public
ResponseDto
<?>
addRightsSettingItem
(
@RequestBody
List
<
RightsSettingItem
>
rightsSettingItems
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
"rightsType"
)
String
rightsType
)
{
rightsSettingBiz
.
batchInsertRightsSettingItem
(
rightsSettingItems
,
rightsSettingId
,
rightsType
);
public
ResponseDto
<?>
addRightsSettingItem
(
@RequestBody
List
<
RightsSettingItem
>
rightsSettingItems
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
"rightsType"
)
String
rightsType
)
{
rightsSettingBiz
.
batchInsertRightsSettingItem
(
rightsSettingItems
,
rightsSettingId
,
rightsType
);
return
new
ResponseDto
<>();
}
@ApiOperation
(
"小程序首页权益基本信息查询"
)
@GetMapping
(
"getRightsSettingByBookId4AppletHome"
)
public
ResponseDto
<?>
getRightsSettingByBookId4AppletHome
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
)
{
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
adviserId
||
null
==
bookId
||
null
==
channelId
)
{
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
)
{
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
adviserId
||
null
==
bookId
||
null
==
channelId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingByBookId4AppletHome
(
bookId
,
adviserId
,
channelId
));
...
...
@@ -110,11 +114,11 @@ public class RightsSettingFacede {
@ApiOperation
(
"小程序首页本周/长期权益查询"
)
@GetMapping
(
"getItemByRightsSettingId4AppletHome"
)
public
ResponseDto
<?>
getItemByRightsSettingId4AppletHome
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
value
=
"rightsType"
,
required
=
false
)
String
rightsType
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
||
StringUtil
.
isEmpty
(
rightsType
))
{
@RequestParam
(
value
=
"rightsType"
,
required
=
false
)
String
rightsType
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
||
StringUtil
.
isEmpty
(
rightsType
))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getItemByRightsSettingId4AppletHome
(
rightsSettingId
,
wechatUserId
,
rightsType
));
...
...
@@ -122,47 +126,75 @@ public class RightsSettingFacede {
@ApiOperation
(
"所有权益分类"
)
@GetMapping
(
"getAllRightsClassify"
)
public
ResponseDto
<
List
<
RightsSettingClassify
>>
getAllRightsClassify
(
@RequestParam
(
value
=
"rightsType"
,
required
=
false
)
String
rightsType
)
{
public
ResponseDto
<
List
<
RightsSettingClassify
>>
getAllRightsClassify
(
@RequestParam
(
value
=
"rightsType"
,
required
=
false
)
String
rightsType
)
{
return
new
ResponseDto
<>(
rightsSettingBiz
.
getAllRightsClassify
(
rightsType
));
}
@ApiOperation
(
"根据权益id获取即享权益项"
)
@GetMapping
(
"getRightsSettingRightsNowItems"
)
public
ResponseDto
<
RightsSetting
>
getRightsSettingRightsNowItems
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
)
throws
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingRightsNowItems
(
rightsSettingId
,
wechatUserId
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingRightsNowItems
(
rightsSettingId
,
wechatUserId
));
}
@SneakyThrows
@ApiOperation
(
"根据权益id和类型获取即享权益项"
)
@GetMapping
(
"getRightsSettingRightsNowItemsByType"
)
public
ResponseDto
<
RightsSetting
>
getRightsSettingRightsNowItemsByType
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"rightsSettingId"
)
@Min
(
value
=
1
,
message
=
"权益id不能小于1"
)
Long
rightsSettingId
,
@RequestParam
(
"rightsSettingType"
)
@Min
(
value
=
1
,
message
=
"权益类型不能小于1"
)
Integer
rightsSettingType
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingRightsNowItemsByType
(
rightsSettingId
,
wechatUserId
,
rightsSettingType
));
}
@ApiOperation
(
"根据权益id获取即享权益项专享礼包"
)
@GetMapping
(
"getRightsSettingGiftCoupons"
)
public
ResponseDto
<
RightsSetting
>
getRightsSettingGiftCoupons
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
)
throws
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
)
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingGiftCoupons
(
rightsSettingId
,
wechatUserId
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
getRightsSettingGiftCoupons
(
rightsSettingId
,
wechatUserId
));
}
@ApiOperation
(
"根据权益id获取即享权益项补充咨询"
)
@GetMapping
(
"getFillRightsSettingApplets"
)
public
ResponseDto
<?>
getFillRightsSettingApplets
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
)
throws
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
getFillRightsSettingApplets
(
rightsSettingId
,
wechatUserId
,
null
,
null
));
}
@ApiOperation
(
"根据权益id获取即享权益配套资料分组集合"
)
@GetMapping
(
"getRightsItemGroups"
)
public
ResponseDto
<?>
getRightsItemGroups
(
@CookieValue
(
"userInfo"
)
String
userInfo
,
@RequestParam
(
"rightsSettingId"
)
Long
rightsSettingId
,
@RequestParam
(
"adviserId"
)
Long
adviserId
,
@RequestParam
(
"bookId"
)
Long
bookId
,
@RequestParam
(
"channelId"
)
Long
channelId
)
throws
PermissionException
{
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
if
(
null
==
rightsSettingId
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_ERROR
,
"参数缺失!"
);
}
return
new
ResponseDto
<>(
rightsSettingBiz
.
get
FillRightsSettingApplets
(
rightsSettingId
,
wechatUserId
));
return
new
ResponseDto
<>(
rightsSettingBiz
.
get
RightsItemGroups
(
rightsSettingId
,
adviserId
,
bookId
,
channelId
,
true
));
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/PcloudGroupActivityBiz.java
View file @
8e45e3a6
...
...
@@ -41,11 +41,7 @@ public interface PcloudGroupActivityBiz {
/**
* 根据分类获取社群共读
* @param firstClassify
* @param secondClassify
* @param gradeLabelId
* @param subjectLabelId
* @return
*/
GroupActivity4AppletDTO
getGroupActivity4Applet
(
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLab
elId
);
GroupActivity4AppletDTO
getGroupActivity4Applet
(
Long
rightSettingId
,
Long
adviserId
,
Long
bookId
,
Long
chann
elId
);
}
pcloud-service-book/src/main/java/com/pcloud/book/skill/biz/impl/PcloudGroupActivityBizImpl.java
View file @
8e45e3a6
...
...
@@ -6,7 +6,9 @@ import com.google.common.collect.Maps;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookBiz
;
import
com.pcloud.book.book.dao.BookLabelDao
;
import
com.pcloud.book.book.dto.BookDto
;
import
com.pcloud.book.book.entity.BookLabel
;
import
com.pcloud.book.consumer.app.AssistTempletConsr
;
import
com.pcloud.book.consumer.label.LabelConsr
;
...
...
@@ -18,6 +20,9 @@ import com.pcloud.book.reading.biz.ReadingActivityBiz;
import
com.pcloud.book.rightsSetting.biz.RightsSettingBiz
;
import
com.pcloud.book.rightsSetting.dto.RightsSettingDto
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingTitle
;
import
com.pcloud.book.rightsSetting.enums.RightsNowItemType
;
import
com.pcloud.book.rightsSetting.mapper.RightsSettingTitleMapper
;
import
com.pcloud.book.skill.biz.PcloudGroupActivityBiz
;
import
com.pcloud.book.skill.dao.PcloudGroupActivityDao
;
import
com.pcloud.book.skill.dao.PcloudSkillDao
;
...
...
@@ -46,6 +51,7 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.UUID
;
import
org.apache.commons.collections.MapUtils
;
...
...
@@ -83,6 +89,10 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
private
BookLabelDao
bookLabelDao
;
@Autowired
private
AssistTempletConsr
assistTempletConsr
;
@Autowired
private
BookBiz
bookBiz
;
@Autowired
private
RightsSettingTitleMapper
rightsSettingTitleMapper
;
@ParamLog
(
"保存共读活动"
)
@Override
...
...
@@ -276,17 +286,31 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
}
@Override
public
GroupActivity4AppletDTO
getGroupActivity4Applet
(
Long
firstClassify
,
Long
secondClassify
,
Long
gradeLabelId
,
Long
subjectLabelId
)
{
public
GroupActivity4AppletDTO
getGroupActivity4Applet
(
Long
rightSettingId
,
Long
adviserId
,
Long
bookId
,
Long
channelId
)
{
BookDto
adviserBook
=
bookBiz
.
getAdviserBook
(
bookId
,
adviserId
,
channelId
);
BookDto
dto
=
Optional
.
ofNullable
(
adviserBook
).
orElseThrow
(()
->
new
BookBizException
(
BookBizException
.
ID_NOT_EXIST
,
"未找到相关书刊"
));
// 处理分类和标签
BaseTempletClassify
baseTempletClassify
=
new
BaseTempletClassify
();
baseTempletClassify
.
setFirstClassify
(
dto
.
getTempletId
());
baseTempletClassify
.
setSecondClassify
(
dto
.
getSecondTempletId
());
baseTempletClassify
.
setGradeLabelId
(
dto
.
getGraLabelId
());
baseTempletClassify
.
setSubjectLabelId
(
dto
.
getSubLabelId
());
rightsSettingBiz
.
setClassifyAndLabel
(
baseTempletClassify
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"firstClassify"
,
firstClassify
);
map
.
put
(
"secondClassify"
,
secondClassify
);
map
.
put
(
"gradeLabelId"
,
gradeLabelId
);
map
.
put
(
"subjectLabelId"
,
subjectLabelId
);
map
.
put
(
"firstClassify"
,
baseTempletClassify
.
getFirstClassify
()
);
map
.
put
(
"secondClassify"
,
baseTempletClassify
.
getSecondClassify
()
);
map
.
put
(
"gradeLabelId"
,
baseTempletClassify
.
getGradeLabelId
()
);
map
.
put
(
"subjectLabelId"
,
baseTempletClassify
.
getSubjectLabelId
()
);
GroupActivity4AppletDTO
groupActivity4AppletDTO
=
pcloudGroupActivityDao
.
getGroupActivity4Applet
(
map
);
if
(
groupActivity4AppletDTO
==
null
){
return
new
GroupActivity4AppletDTO
();
}
// 是否开启社群服务开关
RightsSettingTitle
right
=
rightsSettingTitleMapper
.
getByRightSettingIdAndType
(
rightSettingId
,
RightsNowItemType
.
GROUP_SERVICE
.
value
);
groupActivity4AppletDTO
.
setOpenStatus
(
Objects
.
isNull
(
right
)
?
false
:
right
.
getOpenState
());
groupActivity4AppletDTO
.
setRightsSettingTitle
(
right
.
getRightsSettingTitle
());
groupActivity4AppletDTO
.
setRightsSettingDesc
(
right
.
getRightsSettingDesc
());
String
filterStr
=
StringUtilParent
.
replaceHtml
(
groupActivity4AppletDTO
.
getDesc
());
String
subStr
=
filterStr
.
length
()
>
60
?
filterStr
.
substring
(
0
,
60
)
+
"..."
:
filterStr
;
groupActivity4AppletDTO
.
setCutDesc
(
subStr
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/skill/dto/GroupActivity4AppletDTO.java
View file @
8e45e3a6
...
...
@@ -2,6 +2,7 @@ package com.pcloud.book.skill.dto;
import
com.fasterxml.jackson.annotation.JsonInclude
;
import
com.fasterxml.jackson.annotation.JsonInclude.Include
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.io.Serializable
;
import
java.util.List
;
...
...
@@ -17,6 +18,8 @@ public class GroupActivity4AppletDTO implements Serializable {
private
Long
id
;
private
Boolean
openStatus
;
@ApiModelProperty
(
"共读活动id"
)
private
Long
groupActivityId
;
...
...
@@ -50,4 +53,10 @@ public class GroupActivity4AppletDTO implements Serializable {
@ApiModelProperty
(
"头像列表"
)
private
List
<
String
>
headUrlList
;
@ApiModelProperty
(
"权益标题"
)
private
String
rightsSettingTitle
;
@ApiModelProperty
(
"权益描述"
)
private
String
rightsSettingDesc
;
}
pcloud-service-book/src/main/resources/mapper/rightssetting/RightItemGroup.xml
0 → 100644
View file @
8e45e3a6
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.rightsSetting.dao.impl.RightsItemGroupDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.rightsSetting.entity.RightsItemGroup"
>
<id
property=
"id"
column=
"id"
jdbcType=
"BIGINT"
/>
<result
property=
"rightsSettingId"
column=
"rights_setting_id"
jdbcType=
"BIGINT"
/>
<result
property=
"name"
column=
"name"
jdbcType=
"VARCHAR"
/>
<result
property=
"showState"
column=
"show_state"
jdbcType=
"TINYINT"
/>
<result
property=
"type"
column=
"type"
jdbcType=
"TINYINT"
/>
<result
property=
"pic"
column=
"pic"
jdbcType=
"VARCHAR"
/>
<result
property=
"desc1"
column=
"desc1"
jdbcType=
"VARCHAR"
/>
<result
property=
"desc2"
column=
"desc2"
jdbcType=
"VARCHAR"
/>
<result
property=
"desc3"
column=
"desc3"
jdbcType=
"VARCHAR"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
select
<include
refid=
"Base_Column_List"
/>
from rights_item_group
where id = #{id,jdbcType=BIGINT}
</select>
<delete
id=
"deleteById"
parameterType=
"long"
>
delete from rights_item_group
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsItemGroup"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into rights_item_group
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{rightsSettingId,jdbcType=BIGINT},
#{name,jdbcType=VARCHAR},
#{showState,jdbcType=TINYINT},
#{type,jdbcType=TINYINT},
#{pic,jdbcType=VARCHAR},
#{desc1,jdbcType=VARCHAR},
#{desc2,jdbcType=VARCHAR},
#{desc3,jdbcType=VARCHAR},
NOW()
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsItemGroup"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into rights_item_group (
rights_setting_id, name, show_state, type, pic, desc1, desc2, desc3, create_time
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.rightsSettingId,jdbcType=BIGINT},
#{item.name,jdbcType=VARCHAR},
#{item.showState,jdbcType=TINYINT},
#{item.type,jdbcType=TINYINT},
#{item.pic,jdbcType=VARCHAR},
#{item.desc1,jdbcType=VARCHAR},
#{item.desc2,jdbcType=VARCHAR},
#{item.desc3,jdbcType=VARCHAR},
NOW()
)
</foreach>
</insert>
<delete
id=
"deleteByRightsSettingId"
parameterType=
"long"
>
delete from rights_item_group
where rights_setting_id=#{rightsSettingId}
</delete>
<select
id=
"getListByRightSettingId"
parameterType=
"long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from rights_item_group
where rights_setting_id=#{rightsSettingId}
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightNowItem.xml
View file @
8e45e3a6
...
...
@@ -11,10 +11,11 @@
<result
property=
"type"
column=
"type"
jdbcType=
"BIGINT"
/>
<result
property=
"giftCouponPackageId"
column=
"gift_coupon_package_id"
jdbcType=
"BIGINT"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"rightsItemGroupId"
column=
"rights_item_group_id"
jdbcType=
"BIGINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
id, rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
, rights_item_group_id
</sql>
<select
id=
"getById"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.Long"
>
...
...
@@ -32,7 +33,7 @@
<insert
id=
"insert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsNowItem"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into rights_now_item
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
, rights_item_group_id
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
#{rightsSettingId,jdbcType=BIGINT},
...
...
@@ -41,13 +42,14 @@
#{linkUrl,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER},
#{giftCouponPackageId,jdbcType=BIGINT},
NOW()
NOW(),
#{rightsItemGroupId,jdbcType=BIGINT}
</trim>
</insert>
<insert
id=
"batchInsert"
parameterType=
"com.pcloud.book.rightsSetting.entity.RightsNowItem"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into rights_now_item (
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
, rights_item_group_id
) values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
...
...
@@ -57,7 +59,8 @@
#{item.linkUrl,jdbcType=VARCHAR},
#{item.type,jdbcType=INTEGER},
#{item.giftCouponPackageId,jdbcType=BIGINT},
NOW()
NOW(),
#{item.rightsItemGroupId,jdbcType=BIGINT}
)
</foreach>
</insert>
...
...
@@ -94,7 +97,11 @@
t1.cover_pic giftCouponCoverPic,
t1.denomination giftCouponDenomination,
t1.valid_date_begin giftCouponValidDateBegin,
t1.valid_date_end giftCouponValidDateEnd
t1.valid_date_end giftCouponValidDateEnd,
t1.coupon_type couponType,
t1.instructions instructions,
t1.use_type useType,
t1.exchange_address exchangeAddress
FROM
rights_now_item t
INNER JOIN gift_coupon_package t1 ON t.gift_coupon_package_id = t1.id
...
...
@@ -104,4 +111,13 @@
and now()
<![CDATA[ <= ]]>
t1.valid_date_end
</select>
<select
id=
"getListByGroupIds"
parameterType=
"map"
resultMap=
"BaseResultMap"
>
SELECT
<include
refid=
"Base_Column_List"
/>
from rights_now_item t
where rights_item_group_id in
<foreach
collection=
"groupIds"
item=
"item"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</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