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
70ce8361
Commit
70ce8361
authored
Apr 29, 2020
by
吴博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1002825 小程序配置读书计划
parent
8e45e3a6
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
474 additions
and
9 deletions
+474
-9
BookBizImpl.java
.../main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
+5
-0
BookSet.java
...-book/src/main/java/com/pcloud/book/book/set/BookSet.java
+21
-0
CustomPlanBiz.java
...c/main/java/com/pcloud/book/custom/biz/CustomPlanBiz.java
+2
-0
CustomPlanBizImpl.java
...va/com/pcloud/book/custom/biz/impl/CustomPlanBizImpl.java
+6
-0
CustomPlanMapper.java
.../java/com/pcloud/book/custom/mapper/CustomPlanMapper.java
+3
-0
RightsSettingBizImpl.java
...oud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
+156
-2
RightsCustomRelationDao.java
...cloud/book/rightsSetting/dao/RightsCustomRelationDao.java
+20
-0
RightsReadPlanDao.java
.../com/pcloud/book/rightsSetting/dao/RightsReadPlanDao.java
+16
-0
RightsSettingItemDao.java
...m/pcloud/book/rightsSetting/dao/RightsSettingItemDao.java
+4
-0
RightsCustomRelationDaoImpl.java
...k/rightsSetting/dao/impl/RightsCustomRelationDaoImpl.java
+26
-0
RightsReadPlanDaoImpl.java
...ud/book/rightsSetting/dao/impl/RightsReadPlanDaoImpl.java
+18
-0
RightsSettingItemDaoImpl.java
...book/rightsSetting/dao/impl/RightsSettingItemDaoImpl.java
+16
-0
RightsCustomRelation.java
...cloud/book/rightsSetting/entity/RightsCustomRelation.java
+20
-0
RightsReadPlan.java
.../com/pcloud/book/rightsSetting/entity/RightsReadPlan.java
+26
-0
RightsSettingItem.java
...m/pcloud/book/rightsSetting/entity/RightsSettingItem.java
+16
-0
RightsNowItemType.java
...om/pcloud/book/rightsSetting/enums/RightsNowItemType.java
+4
-2
CustomPlanMapper.xml
...ook/src/main/resources/mapper/custom/CustomPlanMapper.xml
+11
-0
RightsCustomRelation.xml
...n/resources/mapper/rightssetting/RightsCustomRelation.xml
+40
-0
RightsReadPlan.xml
...rc/main/resources/mapper/rightssetting/RightsReadPlan.xml
+37
-0
RightsSettingItemMapper.xml
...esources/mapper/rightssetting/RightsSettingItemMapper.xml
+27
-5
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/book/biz/impl/BookBizImpl.java
View file @
70ce8361
...
...
@@ -428,6 +428,11 @@ public class BookBizImpl implements BookBiz {
BookDto
bookDto
=
bookCache
.
getBookToRedis
(
bookId
);
if
(
null
==
bookDto
)
{
bookDto
=
bookDao
.
getBaseById
(
bookId
);
BookAdviserDto
bookAdviserDto
=
bookAdviserBiz
.
getOneMainBook
(
bookId
);
if
(
null
!=
bookDto
&&
null
!=
bookAdviserDto
){
bookDto
.
setTempletId
(
bookAdviserDto
.
getTempletId
());
bookSet
.
setFirstTemplateName
(
bookDto
);
}
// 将数据存入redis
bookCache
.
setBookToRedis
(
bookDto
);
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/book/set/BookSet.java
View file @
70ce8361
...
...
@@ -1742,4 +1742,25 @@ public class BookSet {
}
}
public
void
setFirstTemplateName
(
BookDto
bookDto
)
{
LOGGER
.
info
(
"设置一级模板名称【START】"
);
if
(
bookDto
==
null
||
bookDto
.
getTempletId
()
==
null
)
{
return
;
}
List
<
Long
>
templetIds
=
new
ArrayList
<>();
if
(
Objects
.
nonNull
(
bookDto
.
getTempletId
()))
{
templetIds
.
add
(
bookDto
.
getTempletId
());
}
Map
<
Long
,
AssistTempletDTO
>
assistTempletMap
=
assistTempletConsr
.
mapByIds4Classify
(
templetIds
);
if
(
MapUtils
.
isEmpty
(
assistTempletMap
))
{
return
;
}
if
(
Objects
.
nonNull
(
bookDto
.
getTempletId
()))
{
setBookDtoTempletInfo
(
assistTempletMap
,
bookDto
,
bookDto
.
getTempletId
());
}
LOGGER
.
info
(
"设置模板名称【END】"
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/custom/biz/CustomPlanBiz.java
View file @
70ce8361
...
...
@@ -50,4 +50,6 @@ public interface CustomPlanBiz {
UserBookServiceVO
getUserBookServiceById
(
Long
userBookServiceId
);
List
<
PlanReadTypeDto
>
getPlanReadTypesByBookId
(
Long
bookId
);
List
<
CustomPlan
>
listByCustomPlanIds
(
List
<
Long
>
customPlanIds
);
}
pcloud-service-book/src/main/java/com/pcloud/book/custom/biz/impl/CustomPlanBizImpl.java
View file @
70ce8361
...
...
@@ -536,4 +536,10 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
List
<
PlanReadTypeDto
>
list
=
customPlanMapper
.
getPlanReadTypesByBookId
(
bookId
);
return
list
;
}
@Override
@ParamLog
(
value
=
"批量获取定制服务"
,
isAfterReturn
=
false
)
public
List
<
CustomPlan
>
listByCustomPlanIds
(
List
<
Long
>
customPlanIds
)
{
return
customPlanMapper
.
getCustomPlanByIds
(
customPlanIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/custom/mapper/CustomPlanMapper.java
View file @
70ce8361
...
...
@@ -39,4 +39,6 @@ public interface CustomPlanMapper {
CustomPlan
getLastCustomPlan
(
@Param
(
"bookIds"
)
List
<
Long
>
bookIds
,
@Param
(
"readType"
)
Integer
readType
);
CustomPlan
getLastCustomPlanByBookIds
(
@Param
(
"bookIds"
)
List
<
Long
>
bookIds
);
List
<
CustomPlan
>
getCustomPlanByIds
(
@Param
(
"customPlanIds"
)
List
<
Long
>
customPlanIds
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/biz/impl/RightsSettingBizImpl.java
View file @
70ce8361
...
...
@@ -3,6 +3,7 @@ package com.pcloud.book.rightsSetting.biz.impl;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.pcloud.appcenter.app.dto.AppDto
;
import
com.pcloud.appcenter.assist.dto.AssistTempletDTO
;
import
com.pcloud.book.applet.biz.AppletNewsBiz
;
...
...
@@ -20,6 +21,9 @@ import com.pcloud.book.consumer.app.AppConsr;
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.custom.biz.CustomPlanBiz
;
import
com.pcloud.book.custom.entity.CustomPlan
;
import
com.pcloud.book.custom.mapper.CustomPlanMapper
;
import
com.pcloud.book.giftcoupon.dao.GiftReceiveDao
;
import
com.pcloud.book.group.biz.BookGroupBiz
;
import
com.pcloud.book.group.dto.BookServeDTO
;
...
...
@@ -29,14 +33,18 @@ 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.RightsCustomRelationDao
;
import
com.pcloud.book.rightsSetting.dao.RightsNowItemDao
;
import
com.pcloud.book.rightsSetting.dao.RightsReadPlanDao
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingDAO
;
import
com.pcloud.book.rightsSetting.dao.RightsSettingItemDao
;
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.RightsCustomRelation
;
import
com.pcloud.book.rightsSetting.entity.RightsNowItem
;
import
com.pcloud.book.rightsSetting.entity.RightsReadPlan
;
import
com.pcloud.book.rightsSetting.entity.RightsSetting
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingClassify
;
import
com.pcloud.book.rightsSetting.entity.RightsSettingItem
;
...
...
@@ -46,6 +54,7 @@ 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
;
...
...
@@ -56,13 +65,21 @@ 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
org.apache.commons.collections.CollectionUtils
;
import
io.swagger.annotations.ApiModelProperty
;
import
java.sql.SQLException
;
import
java.util.Objects
;
import
java.util.Optional
;
import
java.util.function.Function
;
import
lombok.NonNull
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.elasticsearch.common.recycler.Recycler
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.Collections
;
...
...
@@ -94,6 +111,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Autowired
private
RightsNowItemDao
rightsNowItemDao
;
@Autowired
private
RightsReadPlanDao
rightsReadPlanDao
;
@Autowired
private
RightsCustomRelationDao
rightsCustomRelationDao
;
@Autowired
private
RightsSettingItemDao
rightsSettingItemDao
;
@Autowired
private
BookAdviserBiz
bookAdviserBiz
;
...
...
@@ -117,6 +138,10 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private
RightsItemGroupDao
rightsItemGroupDao
;
@Autowired
private
BookGroupBiz
bookGroupBiz
;
private
CustomPlanMapper
customPlanMapper
;
@Autowired
private
CustomPlanBiz
customPlanBiz
;
@Override
@ParamLog
(
"新增权益设置"
)
...
...
@@ -184,6 +209,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
@Override
@ParamLog
(
"更新权益设置"
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateRightsSetting
(
RightsSetting
rightsSetting
)
{
rightsSettingCheck
.
rightsSettingCheck
(
rightsSetting
);
if
(
null
==
rightsSetting
.
getId
())
{
...
...
@@ -199,6 +225,48 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
updateRightNowItemByRightId
(
rightsSetting
);
//新增/修改每周或长期权益
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingWeekItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
WEEK
.
value
);
if
(!
ListUtils
.
isEmpty
(
rightsSetting
.
getRightsSettingWeekItems
())){
for
(
RightsSettingItem
rightsSettingItem
:
rightsSetting
.
getRightsSettingWeekItems
())
{
rightsSettingItem
.
setUuid
(
StringUtil
.
getUUID
());
}
}
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingWeekItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
WEEK
.
value
);
//根据rightsSetting.getId(),RightsTypeEnum.WEEK.value 查询rightSettingItem
RightsSettingItem
rightsSettingItem
=
new
RightsSettingItem
();
rightsSettingItem
.
setRightsSettingId
(
rightsSetting
.
getId
());
rightsSettingItem
.
setRightsType
(
RightsTypeEnum
.
WEEK
.
value
);
List
<
RightsSettingItem
>
list
=
rightsSettingItemDao
.
queryAll
(
rightsSettingItem
);
List
<
RightsReadPlan
>
rightsReadPlans
=
new
ArrayList
<>();
List
<
RightsCustomRelation
>
rightsCustomRelations
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
list
))
{
HashMap
<
String
,
RightsSettingItem
>
map
=
Maps
.
newHashMap
();
for
(
RightsSettingItem
item
:
list
)
{
map
.
put
(
item
.
getUuid
(),
item
);
}
for
(
RightsSettingItem
itemVO
:
rightsSetting
.
getRightsSettingWeekItems
())
{
RightsSettingItem
vo
=
map
.
get
(
itemVO
.
getUuid
());
if
(
Objects
.
isNull
(
vo
)
||
!
RightsNowItemType
.
ONLINE_REMIND
.
value
.
equals
(
vo
.
getRightsClassifyId
().
intValue
()))
{
continue
;
}
RightsReadPlan
rightsReadPlan
=
new
RightsReadPlan
();
rightsReadPlan
.
setRightsSettingItemId
(
vo
.
getId
());
rightsReadPlan
.
setIsOpen
(
itemVO
.
getIsOpen
());
rightsReadPlan
.
setServiceDesc
(
itemVO
.
getServiceDesc
());
rightsReadPlans
.
add
(
rightsReadPlan
);
if
(
ListUtils
.
isEmpty
(
itemVO
.
getCustomPlanList
())){
continue
;
}
for
(
CustomPlan
plan
:
itemVO
.
getCustomPlanList
())
{
RightsCustomRelation
rightsCustomRelation
=
new
RightsCustomRelation
();
rightsCustomRelation
.
setCustomPlanId
(
Long
.
valueOf
(
plan
.
getId
()));
rightsCustomRelation
.
setRightsSettingItemId
(
vo
.
getId
());
rightsCustomRelations
.
add
(
rightsCustomRelation
);
}
}
}
//批量插入rightsReadPlans和rightsCustomRelations
rightsReadPlanDao
.
insert
(
rightsReadPlans
);
rightsCustomRelationDao
.
insert
(
rightsCustomRelations
);
this
.
batchInsertRightsSettingItem
(
rightsSetting
.
getRightsSettingLongTermItems
(),
rightsSetting
.
getId
(),
RightsTypeEnum
.
LONG_TERM
.
value
);
}
...
...
@@ -360,7 +428,48 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
fillRightsNowItems
(
rightsSetting
);
rightsSetting
.
setRightsItemGroups
(
getRightsItemGroups
(
rightsSetting
.
getId
(),
null
,
null
,
null
,
false
));
fillGiftCouponPack
(
rightsSetting
);
rightsSetting
.
setRightsSettingWeekItems
(
getItemsByRightsSettingId
(
id
,
RightsTypeEnum
.
WEEK
.
value
));
List
<
RightsSettingItem
>
rightsItems
=
rightsSettingItemDao
.
getItemsByRightsSettingId4Read
(
id
,
RightsTypeEnum
.
WEEK
.
value
);
List
<
Long
>
itemIdList
=
new
ArrayList
<>();
for
(
RightsSettingItem
item
:
rightsItems
)
{
itemIdList
.
add
(
item
.
getId
());
}
//获取集合对应的rightsCustomRelation
List
<
Long
>
customPlanIds
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
itemIdList
))
{
List
<
RightsCustomRelation
>
rightsCustomRelations
=
rightsCustomRelationDao
.
getCustomByItemIds
(
itemIdList
);
for
(
RightsSettingItem
item
:
rightsItems
)
{
List
<
CustomPlan
>
list
=
new
ArrayList
<>();
for
(
RightsCustomRelation
rightsCustomRelation
:
rightsCustomRelations
)
{
if
(
item
.
getId
().
equals
(
rightsCustomRelation
.
getRightsSettingItemId
()))
{
CustomPlan
customPlan
=
new
CustomPlan
();
customPlan
.
setId
(
Integer
.
valueOf
(
rightsCustomRelation
.
getCustomPlanId
().
toString
()));
list
.
add
(
customPlan
);
customPlanIds
.
add
(
rightsCustomRelation
.
getCustomPlanId
());
}
}
item
.
setCustomPlanList
(
list
);
}
}
List
<
CustomPlan
>
customPlanList
=
new
ArrayList
<>();
if
(!
ListUtils
.
isEmpty
(
customPlanIds
))
{
customPlanList
=
customPlanMapper
.
getCustomPlanByIds
(
customPlanIds
);
}
if
(
ListUtils
.
isEmpty
(
customPlanList
))
{
Map
<
Integer
,
CustomPlan
>
appleMap
=
Optional
.
ofNullable
(
customPlanList
.
stream
().
collect
(
Collectors
.
toMap
(
CustomPlan:
:
getId
,
a
->
a
,
(
k1
,
k2
)
->
k1
)))
.
orElse
(
new
HashMap
<>());
for
(
RightsSettingItem
item
:
rightsItems
)
{
List
<
CustomPlan
>
customPlanList1
=
item
.
getCustomPlanList
();
List
<
CustomPlan
>
customPlanList2
=
new
ArrayList
<>();
for
(
CustomPlan
customPlan
:
customPlanList1
)
{
CustomPlan
customPlan1
=
appleMap
.
get
(
customPlan
.
getId
());
customPlanList2
.
add
(
customPlan1
);
}
item
.
setCustomPlanList
(
customPlanList2
);
}
}
rightsSetting
.
setRightsSettingWeekItems
(
rightsItems
);
rightsSetting
.
setRightsSettingLongTermItems
(
getItemsByRightsSettingId
(
id
,
RightsTypeEnum
.
LONG_TERM
.
value
));
return
rightsSetting
;
}
...
...
@@ -805,6 +914,51 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if
(
ListUtils
.
isEmpty
(
list
))
{
return
new
ArrayList
<>();
}
//先获取阅读计划,若阅读计划为空则推资讯
List
<
Long
>
rightsSettingItemIds
=
list
.
stream
().
filter
(
e
->
YesOrNoEnums
.
YES
.
getValue
().
equals
(
e
.
getIsOpen
())).
map
(
e
->
e
.
getId
()).
collect
(
Collectors
.
toList
());
if
(!
ListUtils
.
isEmpty
(
rightsSettingItemIds
))
{
List
<
RightsCustomRelation
>
rightsCustomRelations
=
rightsCustomRelationDao
.
getCustomByItemIds
(
rightsSettingItemIds
);
list
=
setReadPlan4Week
(
rightsCustomRelations
,
list
);
}
else
{
list
=
setAppletNews4Week
(
rightsSettingId
,
rightsType
,
wechatUserId
,
list
);
}
return
list
;
}
private
List
<
RightsSettingItem
>
setReadPlan4Week
(
List
<
RightsCustomRelation
>
rightsCustomRelations
,
List
<
RightsSettingItem
>
list
)
{
log
.
info
(
"为每周权益设置读书计划"
);
if
(
ListUtils
.
isEmpty
(
list
)
||
ListUtils
.
isEmpty
(
rightsCustomRelations
))
{
return
list
;
}
List
<
Long
>
customPlanIds
=
rightsCustomRelations
.
stream
().
map
(
e
->
e
.
getCustomPlanId
()).
collect
(
Collectors
.
toList
());
if
(
ListUtils
.
isEmpty
(
customPlanIds
))
{
return
list
;
}
Map
<
Long
,
List
<
RightsCustomRelation
>>
rightsCustomRelationMap
=
rightsCustomRelations
.
stream
().
collect
(
Collectors
.
groupingBy
(
RightsCustomRelation:
:
getRightsSettingItemId
));
List
<
CustomPlan
>
customPlans
=
customPlanMapper
.
getCustomPlanByIds
(
customPlanIds
);
if
(
ListUtils
.
isEmpty
(
customPlans
))
{
return
list
;
}
Map
<
Integer
,
CustomPlan
>
customPlanMap
=
customPlans
.
stream
().
collect
(
Collectors
.
toMap
(
CustomPlan:
:
getId
,
a
->
a
,
(
k1
,
k2
)
->
k1
));
for
(
RightsSettingItem
item
:
list
)
{
List
<
CustomPlan
>
customPlans4ReadPlan
=
new
ArrayList
<>();
List
<
RightsCustomRelation
>
customRelations
=
rightsCustomRelationMap
.
get
(
item
.
getId
());
if
(
ListUtils
.
isEmpty
(
customRelations
))
{
continue
;
}
for
(
RightsCustomRelation
rightsCustomRelation
:
customRelations
)
{
if
(
customPlanMap
.
containsKey
(
rightsCustomRelation
.
getCustomPlanId
().
intValue
()))
{
customPlans4ReadPlan
.
add
(
customPlanMap
.
get
(
rightsCustomRelation
.
getCustomPlanId
().
intValue
()));
}
}
item
.
setCustomPlanList
(
customPlans4ReadPlan
);
}
return
list
;
}
private
List
<
RightsSettingItem
>
setAppletNews4Week
(
Long
rightsSettingId
,
String
rightsType
,
Long
wechatUserId
,
List
<
RightsSettingItem
>
list
)
{
RightsSetting
rightsSetting
=
rightsSettingDAO
.
selectByPrimaryKey
(
rightsSettingId
);
if
(
rightsSetting
.
getRightsSettingType
()
==
2
)
{
//书刊权益,分类标签从编辑书刊取
BookAdviserDto
adviserDto
=
bookAdviserBiz
.
getOneMainBook
(
rightsSetting
.
getBookId
());
...
...
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsCustomRelationDao.java
0 → 100644
View file @
70ce8361
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
;
import
com.pcloud.book.rightsSetting.entity.RightsCustomRelation
;
import
com.pcloud.book.rightsSetting.entity.RightsReadPlan
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:44
**/
public
interface
RightsCustomRelationDao
extends
BaseDao
<
RightsCustomRelation
>
{
List
<
RightsCustomRelation
>
getCustomByItemIds
(
List
<
Long
>
itemIdList
);
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsReadPlanDao.java
0 → 100644
View file @
70ce8361
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
;
import
com.pcloud.book.rightsSetting.entity.RightsReadPlan
;
import
com.pcloud.common.core.dao.BaseDao
;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:44
**/
public
interface
RightsReadPlanDao
extends
BaseDao
<
RightsReadPlan
>
{
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsSettingItemDao.java
View file @
70ce8361
...
...
@@ -39,4 +39,7 @@ public interface RightsSettingItemDao extends BaseDao<RightsSettingItem>{
*/
List
<
RightsSettingClassify
>
getAllRightsClassify
(
String
rightsType
);
List
<
RightsSettingItem
>
getItemByRightsIdAndType
(
Long
rightsSettingId
,
String
rightsType
);
List
<
RightsSettingItem
>
getItemsByRightsSettingId4Read
(
Long
rightsSettingId
,
String
rightsType
);
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsCustomRelationDaoImpl.java
0 → 100644
View file @
70ce8361
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
.
impl
;
import
com.pcloud.book.rightsSetting.dao.RightsCustomRelationDao
;
import
com.pcloud.book.rightsSetting.dao.RightsReadPlanDao
;
import
com.pcloud.book.rightsSetting.entity.RightsCustomRelation
;
import
com.pcloud.book.rightsSetting.entity.RightsReadPlan
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:44
**/
@Component
(
"rightsCustomRelationDao"
)
public
class
RightsCustomRelationDaoImpl
extends
BaseDaoImpl
<
RightsCustomRelation
>
implements
RightsCustomRelationDao
{
@Override
public
List
<
RightsCustomRelation
>
getCustomByItemIds
(
List
<
Long
>
itemIdList
)
{
return
getSqlSession
().
selectList
(
getStatement
(
"getCustomByItemIds"
),
itemIdList
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsReadPlanDaoImpl.java
0 → 100644
View file @
70ce8361
package
com
.
pcloud
.
book
.
rightsSetting
.
dao
.
impl
;
import
com.pcloud.book.rightsSetting.dao.RightsReadPlanDao
;
import
com.pcloud.book.rightsSetting.entity.RightsReadPlan
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:44
**/
@Component
(
"rightsReadPlanDao"
)
public
class
RightsReadPlanDaoImpl
extends
BaseDaoImpl
<
RightsReadPlan
>
implements
RightsReadPlanDao
{
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsSettingItemDaoImpl.java
View file @
70ce8361
...
...
@@ -38,4 +38,20 @@ public class RightsSettingItemDaoImpl extends BaseDaoImpl<RightsSettingItem> imp
map
.
put
(
"rightsType"
,
rightsType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAllRightsClassify"
),
map
);
}
@Override
public
List
<
RightsSettingItem
>
getItemByRightsIdAndType
(
Long
rightsSettingId
,
String
rightsType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"rightsSettingId"
,
rightsSettingId
);
map
.
put
(
"rightsType"
,
rightsType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getItemByRightsIdAndType"
),
map
);
}
@Override
public
List
<
RightsSettingItem
>
getItemsByRightsSettingId4Read
(
Long
rightsSettingId
,
String
rightsType
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"rightsSettingId"
,
rightsSettingId
);
map
.
put
(
"rightsType"
,
rightsType
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getItemsByRightsSettingId4Read"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsCustomRelation.java
0 → 100644
View file @
70ce8361
package
com
.
pcloud
.
book
.
rightsSetting
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:41
**/
@Data
public
class
RightsCustomRelation
extends
BaseEntity
{
@ApiModelProperty
(
"定制服务方案id"
)
private
Long
customPlanId
;
@ApiModelProperty
(
"权益内容id"
)
private
Long
rightsSettingItemId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsReadPlan.java
0 → 100644
View file @
70ce8361
package
com
.
pcloud
.
book
.
rightsSetting
.
entity
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* @Description
* @Author zengpo
* @Date 2020/4/27 17:41
**/
@Data
public
class
RightsReadPlan
extends
BaseEntity
{
@ApiModelProperty
(
"主键"
)
private
Long
id
;
@ApiModelProperty
(
"权益内容id"
)
private
Long
rightsSettingItemId
;
@ApiModelProperty
(
"本书阅读计划开关 0关闭 1开启"
)
private
Integer
isOpen
;
@ApiModelProperty
(
"服务说明"
)
private
String
serviceDesc
;
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/entity/RightsSettingItem.java
View file @
70ce8361
...
...
@@ -2,12 +2,14 @@ package com.pcloud.book.rightsSetting.entity;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.applet.dto.AppletNewsDTO
;
import
com.pcloud.book.custom.entity.CustomPlan
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
java.io.Serializable
;
import
java.util.List
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
...
...
@@ -54,4 +56,17 @@ public class RightsSettingItem extends BaseEntity {
* 资讯
*/
private
List
<
AppletNewsDTO
>
appletNewsDTOS
;
@ApiModelProperty
(
"本书阅读计划开关 0关闭 1开启"
)
private
Integer
isOpen
;
@ApiModelProperty
(
"服务说明"
)
private
String
serviceDesc
;
@ApiModelProperty
(
"定制服务方案集合"
)
private
List
<
CustomPlan
>
customPlanList
;
@ApiModelProperty
(
"唯一键"
)
private
String
uuid
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/enums/RightsNowItemType.java
View file @
70ce8361
...
...
@@ -27,11 +27,13 @@ public enum RightsNowItemType {
/**
* 6 配套资料
*/
SERVES
(
6
)
;
SERVES
(
6
)
,
/**
*
值
*
7线上学习/阅读提醒
*/
ONLINE_REMIND
(
7
);
public
final
Integer
value
;
RightsNowItemType
(
Integer
value
)
{
...
...
pcloud-service-book/src/main/resources/mapper/custom/CustomPlanMapper.xml
View file @
70ce8361
...
...
@@ -261,4 +261,14 @@
ORDER BY id DESC
LIMIT 1
</select>
<select
id=
"getCustomPlanByIds"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from custom_plan
where id IN
<foreach
collection=
"customPlanIds"
item=
"item"
separator=
","
open=
"("
close=
")"
>
${item}
</foreach>
ORDER BY id DESC
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsCustomRelation.xml
0 → 100644
View file @
70ce8361
<?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.RightsCustomRelationDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.rightsSetting.entity.RightsCustomRelation"
>
<result
property=
"rightsSettingItemId"
column=
"rights_setting_item_id"
jdbcType=
"BIGINT"
/>
<result
property=
"customPlanId"
column=
"custom_plan_id"
jdbcType=
"BIGINT"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
rights_setting_item_id, custom_plan_id, create_time, update_time
</sql>
<!--批量新增-->
<insert
id=
"batchInsert"
useGeneratedKeys=
"true"
parameterType=
"java.util.List"
>
insert into book.rights_custom_relation (
rights_setting_item_id, custom_plan_id, create_time, update_time
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.rightsSettingItemId},
#{item.customPlanId},
NOW(),
NOW()
)
</foreach>
</insert>
<select
id=
"getCustomByItemIds"
parameterType=
"java.util.List"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from rights_custom_relation where 1=1 and
rights_setting_item_id IN
<foreach
collection=
"list"
item=
"item"
separator=
","
open=
"("
close=
")"
>
${item}
</foreach>
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsReadPlan.xml
0 → 100644
View file @
70ce8361
<?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.RightsReadPlanDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.rightsSetting.entity.RightsReadPlan"
>
<id
property=
"id"
column=
"id"
jdbcType=
"BIGINT"
/>
<result
property=
"rightsSettingItemId"
column=
"rights_setting_item_id"
jdbcType=
"BIGINT"
/>
<result
property=
"isOpen"
column=
"is_open"
jdbcType=
"INTEGER"
/>
<result
property=
"serviceDesc"
column=
"service_desc"
jdbcType=
"VARCHAR"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"updateTime"
column=
"update_time"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, rights_setting_item_id, is_open, service_desc, create_time, update_time
</sql>
<!--批量新增-->
<insert
id=
"batchInsert"
useGeneratedKeys=
"true"
parameterType=
"java.util.List"
>
insert into book.rights_read_plan (
rights_setting_item_id, is_open, service_desc, create_time, update_time
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.rightsSettingItemId},
#{item.isOpen},
#{item.serviceDesc},
NOW(),
NOW()
)
</foreach>
</insert>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightsSettingItemMapper.xml
View file @
70ce8361
...
...
@@ -10,6 +10,7 @@
<result
property=
"description"
column=
"description"
jdbcType=
"VARCHAR"
/>
<result
property=
"createTime"
column=
"create_time"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"title"
column=
"title"
jdbcType=
"VARCHAR"
/>
<result
property=
"uuid"
column=
"uuid"
jdbcType=
"VARCHAR"
/>
</resultMap>
<!--通过实体作为筛选条件查询-->
...
...
@@ -17,8 +18,9 @@
select
i.id, i.rights_setting_id rightsSettingId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.description, i.create_time createTime, i.title
i.description, i.create_time createTime, i.title
,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc
from book.rights_setting_item i
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
<where>
<if
test=
"id != null"
>
and i.id = #{id}
...
...
@@ -38,8 +40,8 @@
<!--新增所有列-->
<insert
id=
"insert"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title)
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title})
insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title
,uuid
)
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title}
,#{uuid}
)
</insert>
<!--通过权益主键删除-->
...
...
@@ -54,7 +56,7 @@
<!--批量新增-->
<insert
id=
"batchInsert"
useGeneratedKeys=
"true"
parameterType=
"java.util.List"
>
insert into book.rights_setting_item (
rights_setting_id, rights_type, rights_classify_id, description, create_time,title
rights_setting_id, rights_type, rights_classify_id, description, create_time,title
,uuid
)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
...
...
@@ -64,7 +66,8 @@
#{item.rightsClassifyId,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
NOW(),
#{item.title}
#{item.title},
#{item.uuid}
)
</foreach>
</insert>
...
...
@@ -78,4 +81,22 @@
</if>
</select>
<select
id=
"getItemsByRightsSettingId4Read"
parameterType=
"map"
resultType=
"com.pcloud.book.rightsSetting.entity.RightsSettingItem"
>
select
i.id, i.rights_setting_id rightsSettingId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.description, i.create_time createTime, i.title,i.uuid,IFNULL(p.is_open,0) isOpen,p.service_desc serviceDesc
from book.rights_setting_item i
left join book.rights_read_plan p on i.id=p.rights_setting_item_id
<where>
<if
test=
"rightsSettingId != null"
>
and i.rights_setting_id = #{rightsSettingId}
</if>
<if
test=
"rightsType != null and rightsType != ''"
>
and i.rights_type = #{rightsType}
</if>
</where>
order by i.id asc
</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