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
ff4ced8a
Commit
ff4ced8a
authored
Oct 22, 2020
by
郑勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: [1003726] 首页改版-新人礼包模块部分
parent
ba04f363
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
1510 additions
and
46 deletions
+1510
-46
ServeInfoDTO.java
...ain/java/com/pcloud/book/giftcoupon/dto/ServeInfoDTO.java
+28
-0
AppletThirdResourcesVo.java
...com/pcloud/book/giftcoupon/vo/AppletThirdResourcesVo.java
+63
-0
GiftCouponVo.java
...main/java/com/pcloud/book/giftcoupon/vo/GiftCouponVo.java
+12
-0
AppletThirdResourcesBiz.java
...a/com/pcloud/book/applet/biz/AppletThirdResourcesBiz.java
+4
-0
AppletThirdResourcesBizImpl.java
...oud/book/applet/biz/impl/AppletThirdResourcesBizImpl.java
+5
-0
AppletThirdResourcesDao.java
...a/com/pcloud/book/applet/dao/AppletThirdResourcesDao.java
+4
-0
AppletUserBookcaseDao.java
...ava/com/pcloud/book/applet/dao/AppletUserBookcaseDao.java
+2
-0
AppletThirdResourcesDaoImpl.java
...oud/book/applet/dao/impl/AppletThirdResourcesDaoImpl.java
+13
-0
AppletUserBookcaseDaoImpl.java
...cloud/book/applet/dao/impl/AppletUserBookcaseDaoImpl.java
+7
-0
ThirdResourceRecordDTO.java
...va/com/pcloud/book/applet/dto/ThirdResourceRecordDTO.java
+2
-0
AppletThirdResourcesClick.java
.../pcloud/book/applet/entity/AppletThirdResourcesClick.java
+3
-0
GiftCouponPackageBiz.java
.../com/pcloud/book/giftcoupon/biz/GiftCouponPackageBiz.java
+12
-4
GiftCouponPackageBizImpl.java
...ud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
+361
-10
GiftParamCheck.java
...java/com/pcloud/book/giftcoupon/check/GiftParamCheck.java
+41
-11
GiftCategoryDao.java
.../java/com/pcloud/book/giftcoupon/dao/GiftCategoryDao.java
+32
-0
GiftCouponPackageDao.java
.../com/pcloud/book/giftcoupon/dao/GiftCouponPackageDao.java
+10
-0
GiftReceiveDao.java
...n/java/com/pcloud/book/giftcoupon/dao/GiftReceiveDao.java
+4
-0
GiftCategoryDaoImpl.java
.../pcloud/book/giftcoupon/dao/impl/GiftCategoryDaoImpl.java
+61
-0
GiftCouponPackageDaoImpl.java
...ud/book/giftcoupon/dao/impl/GiftCouponPackageDaoImpl.java
+26
-0
GiftReceiveDaoImpl.java
...m/pcloud/book/giftcoupon/dao/impl/GiftReceiveDaoImpl.java
+14
-0
BatchUpdateDTO.java
...n/java/com/pcloud/book/giftcoupon/dto/BatchUpdateDTO.java
+30
-0
ExceptionDTO.java
...ain/java/com/pcloud/book/giftcoupon/dto/ExceptionDTO.java
+14
-0
GiftCategoryDTO.java
.../java/com/pcloud/book/giftcoupon/dto/GiftCategoryDTO.java
+36
-0
GiftPackageDTO.java
...n/java/com/pcloud/book/giftcoupon/dto/GiftPackageDTO.java
+103
-4
MyGiftPackageDTO.java
...java/com/pcloud/book/giftcoupon/dto/MyGiftPackageDTO.java
+66
-1
GiftCategory.java
.../java/com/pcloud/book/giftcoupon/entity/GiftCategory.java
+27
-0
GiftCouponPackage.java
.../com/pcloud/book/giftcoupon/entity/GiftCouponPackage.java
+55
-0
CouponTypeEnum.java
...java/com/pcloud/book/giftcoupon/enums/CouponTypeEnum.java
+5
-1
GiftCouponPackageFacade.java
...cloud/book/giftcoupon/facade/GiftCouponPackageFacade.java
+30
-3
GiftCouponServiceImpl.java
...d/book/giftcoupon/service/impl/GiftCouponServiceImpl.java
+8
-1
RightsNowItemDao.java
...a/com/pcloud/book/rightsSetting/dao/RightsNowItemDao.java
+6
-0
RightsNowItemDaoImpl.java
...oud/book/rightsSetting/dao/impl/RightsNowItemDaoImpl.java
+4
-0
AppletThirdResources.xml
...src/main/resources/mapper/applet/AppletThirdResources.xml
+57
-0
AppletThirdResourcesClickMapper.xml
...sources/mapper/applet/AppletThirdResourcesClickMapper.xml
+6
-3
AppletUserBookcase.xml
...k/src/main/resources/mapper/applet/AppletUserBookcase.xml
+17
-0
GiftCategory.xml
...ook/src/main/resources/mapper/giftConpon/GiftCategory.xml
+166
-0
GiftCouplePackageDao.xml
...main/resources/mapper/giftConpon/GiftCouplePackageDao.xml
+132
-6
GiftReceiveDao.xml
...k/src/main/resources/mapper/giftConpon/GiftReceiveDao.xml
+30
-2
RightNowItem.xml
.../src/main/resources/mapper/rightssetting/RightNowItem.xml
+14
-0
No files found.
pcloud-facade-book/src/main/java/com/pcloud/book/giftcoupon/dto/ServeInfoDTO.java
0 → 100644
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
import
java.util.List
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
ServeInfoDTO
{
@ApiModelProperty
(
"应用/资讯/作品id"
)
private
Long
serveId
;
@ApiModelProperty
(
"应用/资讯/作品类型"
)
private
String
serveType
;
@ApiModelProperty
(
"链接url"
)
private
String
linkUrl
;
@ApiModelProperty
(
"应用/资讯/作品图片"
)
private
String
servePic
;
@ApiModelProperty
(
"应用/资讯/作品名称"
)
private
String
serveName
;
@ApiModelProperty
(
"应用/资讯/作品类型名称"
)
private
String
serveTypeName
;
@ApiModelProperty
(
"应用/资讯/作品类型编码"
)
private
String
serveTypeCode
;
@ApiModelProperty
(
"结果链接"
)
private
String
resultUrl
;
@ApiModelProperty
(
"商品应用中有第三方链接"
)
private
Boolean
hasThirdLink
;
}
pcloud-facade-book/src/main/java/com/pcloud/book/giftcoupon/vo/AppletThirdResourcesVo.java
0 → 100644
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
vo
;
import
com.pcloud.common.entity.BaseEntity
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
AppletThirdResourcesVo
extends
BaseEntity
{
@ApiModelProperty
(
"第三方资源编号"
)
private
String
number
;
@ApiModelProperty
(
"类型 0:小程序, 1:链接"
)
private
Long
type
;
@ApiModelProperty
(
"第三方资源名称"
)
private
String
name
;
@ApiModelProperty
(
"小程序id"
)
private
String
appletsId
;
@ApiModelProperty
(
"来源"
)
private
String
source
;
@ApiModelProperty
(
"宣传图片"
)
private
String
resourceImgUrl
;
@ApiModelProperty
(
"链接"
)
private
String
url
;
@ApiModelProperty
(
"备注"
)
private
String
remark
;
@ApiModelProperty
(
"创建人"
)
private
Long
creator
;
@ApiModelProperty
(
"修改人"
)
private
Long
updator
;
@ApiModelProperty
(
"第三方资源路径 默认0:客服窗口 1:公众号文章素材"
)
private
Integer
routeCode
;
@ApiModelProperty
(
"引导语,限制30字符"
)
private
String
guide
;
@ApiModelProperty
(
"素材地址"
)
private
String
materialUrl
;
@ApiModelProperty
(
"顶图"
)
private
String
topImgUrl
;
@ApiModelProperty
(
"浮动图"
)
private
String
floatImgUrl
;
@ApiModelProperty
(
"按钮图"
)
private
String
buttonImgUrl
;
@ApiModelProperty
(
"位置 1 顶部 2 底部"
)
private
Integer
showType
;
}
\ No newline at end of file
pcloud-facade-book/src/main/java/com/pcloud/book/giftcoupon/vo/GiftCouponVo.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
vo
;
package
com
.
pcloud
.
book
.
giftcoupon
.
vo
;
import
com.pcloud.book.giftcoupon.dto.ServeInfoDTO
;
import
com.pcloud.common.entity.BaseEntity
;
import
com.pcloud.common.entity.BaseEntity
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -56,6 +57,16 @@ public class GiftCouponVo extends BaseEntity {
...
@@ -56,6 +57,16 @@ public class GiftCouponVo extends BaseEntity {
* 兑换地址
* 兑换地址
*/
*/
private
String
exchangeAddress
;
private
String
exchangeAddress
;
/**
* 跳转外链编号
*/
private
String
urlNumber
;
/**
* 课程券第三方链接对象
*/
private
AppletThirdResourcesVo
appletThirdResources
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/AppletThirdResourcesBiz.java
View file @
ff4ced8a
...
@@ -6,6 +6,8 @@ import com.pcloud.book.applet.entity.AppletThirdResources;
...
@@ -6,6 +6,8 @@ import com.pcloud.book.applet.entity.AppletThirdResources;
import
com.pcloud.book.applet.entity.AppletThirdResourcesClick
;
import
com.pcloud.book.applet.entity.AppletThirdResourcesClick
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
public
interface
AppletThirdResourcesBiz
{
public
interface
AppletThirdResourcesBiz
{
AppletThirdResourcesDTO
getAnalysisDetail
(
Long
thirdResourcesId
);
AppletThirdResourcesDTO
getAnalysisDetail
(
Long
thirdResourcesId
);
...
@@ -26,6 +28,8 @@ public interface AppletThirdResourcesBiz {
...
@@ -26,6 +28,8 @@ public interface AppletThirdResourcesBiz {
AppletThirdResources
getAppletsById
(
Long
id
);
AppletThirdResources
getAppletsById
(
Long
id
);
List
<
AppletThirdResources
>
getAppletsByIds
(
List
<
Long
>
ids
);
void
createThirdResources
(
AppletThirdResourcesDTO
thirdResourcesDTO
);
void
createThirdResources
(
AppletThirdResourcesDTO
thirdResourcesDTO
);
PageBeanNew
<
ThirdResourceRecordDTO
>
listThirdResourceRecord
(
String
queryName
,
Integer
currentPage
,
Integer
numPerPage
,
String
wechatUser
,
Long
thirdResourceId
,
Integer
recordType
);
PageBeanNew
<
ThirdResourceRecordDTO
>
listThirdResourceRecord
(
String
queryName
,
Integer
currentPage
,
Integer
numPerPage
,
String
wechatUser
,
Long
thirdResourceId
,
Integer
recordType
);
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/biz/impl/AppletThirdResourcesBizImpl.java
View file @
ff4ced8a
...
@@ -220,6 +220,11 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
...
@@ -220,6 +220,11 @@ public class AppletThirdResourcesBizImpl implements AppletThirdResourcesBiz {
}
}
@Override
@Override
public
List
<
AppletThirdResources
>
getAppletsByIds
(
List
<
Long
>
ids
)
{
return
thirdResourcesDao
.
getAppletsByIds
(
ids
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
createThirdResources
(
AppletThirdResourcesDTO
thirdResourcesDTO
)
{
public
void
createThirdResources
(
AppletThirdResourcesDTO
thirdResourcesDTO
)
{
AppletThirdResources
thirdResources
=
new
AppletThirdResources
();
AppletThirdResources
thirdResources
=
new
AppletThirdResources
();
...
...
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletThirdResourcesDao.java
View file @
ff4ced8a
...
@@ -15,4 +15,8 @@ public interface AppletThirdResourcesDao extends BaseDao<AppletThirdResources> {
...
@@ -15,4 +15,8 @@ public interface AppletThirdResourcesDao extends BaseDao<AppletThirdResources> {
List
<
AppletThirdResources
>
getThirdResourcesByNewsId
(
Long
newsId
);
List
<
AppletThirdResources
>
getThirdResourcesByNewsId
(
Long
newsId
);
Map
<
Long
,
AppletConfigPointDTO
>
getConfigPoint
(
List
<
Long
>
thirdResourcesId
);
Map
<
Long
,
AppletConfigPointDTO
>
getConfigPoint
(
List
<
Long
>
thirdResourcesId
);
List
<
AppletThirdResources
>
getAppletsByIds
(
List
<
Long
>
ids
);
AppletThirdResources
getByResourcesId
(
Long
id
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/AppletUserBookcaseDao.java
View file @
ff4ced8a
...
@@ -103,4 +103,6 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
...
@@ -103,4 +103,6 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
AppletUserBookcase
getUserReadBook
(
Long
wechatUserId
);
AppletUserBookcase
getUserReadBook
(
Long
wechatUserId
);
BaseTempletClassify
getBookClassifyInfo
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
BaseTempletClassify
getBookClassifyInfo
(
Long
bookId
,
Long
channelId
,
Long
adviserId
);
BaseTempletClassify
getLastReadBookInfo
(
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletThirdResourcesDaoImpl.java
View file @
ff4ced8a
...
@@ -34,4 +34,17 @@ public class AppletThirdResourcesDaoImpl extends BaseDaoImpl<AppletThirdResource
...
@@ -34,4 +34,17 @@ public class AppletThirdResourcesDaoImpl extends BaseDaoImpl<AppletThirdResource
return
getSessionTemplate
().
selectMap
(
getStatement
(
"getConfigPoint"
),
map
,
"thirdResourcesId"
);
return
getSessionTemplate
().
selectMap
(
getStatement
(
"getConfigPoint"
),
map
,
"thirdResourcesId"
);
}
}
@Override
public
List
<
AppletThirdResources
>
getAppletsByIds
(
List
<
Long
>
ids
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"ids"
,
ids
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getAppletsByIds"
),
map
);
}
@Override
public
AppletThirdResources
getByResourcesId
(
Long
id
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"id"
,
id
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getByResourcesId"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dao/impl/AppletUserBookcaseDaoImpl.java
View file @
ff4ced8a
...
@@ -141,4 +141,11 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
...
@@ -141,4 +141,11 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
map
.
put
(
"bookId"
,
bookId
);
map
.
put
(
"bookId"
,
bookId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getBookClassifyInfo"
),
map
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getBookClassifyInfo"
),
map
);
}
}
@Override
public
BaseTempletClassify
getLastReadBookInfo
(
Long
wechatUserId
)
{
Map
<
String
,
Long
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"getLastReadBookInfo"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/dto/ThirdResourceRecordDTO.java
View file @
ff4ced8a
...
@@ -25,4 +25,6 @@ public class ThirdResourceRecordDTO {
...
@@ -25,4 +25,6 @@ public class ThirdResourceRecordDTO {
)
)
private
Date
createTime
;
private
Date
createTime
;
private
Long
thirdResourceId
;
private
Long
thirdResourceId
;
private
Long
giftPackageId
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/applet/entity/AppletThirdResourcesClick.java
View file @
ff4ced8a
...
@@ -28,4 +28,6 @@ public class AppletThirdResourcesClick extends BaseEntity {
...
@@ -28,4 +28,6 @@ public class AppletThirdResourcesClick extends BaseEntity {
private
Long
rightsSettingClassifyId
;
private
Long
rightsSettingClassifyId
;
@ApiModelProperty
(
"权益分类id"
)
@ApiModelProperty
(
"权益分类id"
)
private
Long
newsId
;
private
Long
newsId
;
@ApiModelProperty
(
"奖包券id"
)
private
Long
giftPackageId
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/GiftCouponPackageBiz.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
biz
;
package
com
.
pcloud
.
book
.
giftcoupon
.
biz
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.giftcoupon.dto.BatchReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.BatchReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.BatchUpdateDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
java.util.List
;
public
interface
GiftCouponPackageBiz
{
public
interface
GiftCouponPackageBiz
{
void
createGiftPackage
(
GiftCouponPackage
giftCouponPackage
);
void
createGiftPackage
(
GiftCouponPackage
giftCouponPackage
);
void
updateGiftPackage
(
GiftCouponPackage
giftCouponPackage
);
void
updateGiftPackage
(
GiftCouponPackage
giftCouponPackage
);
Gift
CouponPackage
getGiftPackage
(
Long
id
);
Gift
PackageDTO
getGiftPackage
(
Long
id
);
void
deleteGiftPackage
(
Long
id
);
void
deleteGiftPackage
(
Long
id
);
void
createGiftReceive
(
GiftReceive
giftReceive
);
void
createGiftReceive
(
GiftReceive
giftReceive
)
throws
BookBizException
;
PageBeanNew
<
GiftPackageDTO
>
list4GiftPackage
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Long
agentId
);
PageBeanNew
<
GiftPackageDTO
>
list4GiftPackage
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Long
agentId
,
Boolean
onShelves
);
PageBeanNew
<
My
GiftPackageDTO
>
list4MyGiftPackage
(
Integer
state
,
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
GiftPackageDTO
>
list4MyGiftPackage
(
Integer
state
,
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
);
void
useGiftCoupon
(
Long
wechatUserId
,
Long
receiveId
);
void
useGiftCoupon
(
Long
wechatUserId
,
Long
receiveId
);
...
@@ -41,4 +45,8 @@ public interface GiftCouponPackageBiz {
...
@@ -41,4 +45,8 @@ public interface GiftCouponPackageBiz {
* * @param null
* * @param null
*/
*/
PageBeanNew
<
GiftPackageDTO
>
listGiftPackage4Analysis
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Integer
linkOnly
,
Integer
clickQty
,
Long
agentId
);
PageBeanNew
<
GiftPackageDTO
>
listGiftPackage4Analysis
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Integer
linkOnly
,
Integer
clickQty
,
Long
agentId
);
void
batchUpdateGift
(
BatchUpdateDTO
batchUpdateDTO
);
List
<
GiftPackageDTO
>
listGiftPackage4Wechat
(
Long
wechatUserId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
biz
.
impl
;
package
com
.
pcloud
.
book
.
giftcoupon
.
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.AppletThirdResourcesBiz
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
import
com.pcloud.book.applet.dao.AppletLinkClickDao
;
import
com.pcloud.book.applet.dao.AppletThirdResourcesDao
;
import
com.pcloud.book.applet.dao.AppletUserBookcaseDao
;
import
com.pcloud.book.applet.dto.PvuvDTO
;
import
com.pcloud.book.applet.dto.PvuvDTO
;
import
com.pcloud.book.applet.entity.AppletThirdResources
;
import
com.pcloud.book.applet.enums.DataRecordTypeEnum
;
import
com.pcloud.book.applet.enums.DataRecordTypeEnum
;
import
com.pcloud.book.applet.enums.DataTypeEnum
;
import
com.pcloud.book.applet.enums.DataTypeEnum
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.book.biz.BookLabelBiz
;
import
com.pcloud.book.book.constant.BookConstant
;
import
com.pcloud.book.book.constant.BookConstant
;
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.label.LabelConsr
;
import
com.pcloud.book.consumer.resource.ProductConsr
;
import
com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz
;
import
com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz
;
import
com.pcloud.book.giftcoupon.check.GiftParamCheck
;
import
com.pcloud.book.giftcoupon.check.GiftParamCheck
;
import
com.pcloud.book.giftcoupon.dao.GiftCategoryDao
;
import
com.pcloud.book.giftcoupon.dao.GiftCouponPackageDao
;
import
com.pcloud.book.giftcoupon.dao.GiftCouponPackageDao
;
import
com.pcloud.book.giftcoupon.dao.GiftReceiveDao
;
import
com.pcloud.book.giftcoupon.dao.GiftReceiveDao
;
import
com.pcloud.book.giftcoupon.dto.BatchReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.BatchReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.BatchUpdateDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftCategoryDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.ServeInfoDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCategory
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.enums.CouponTypeEnum
;
import
com.pcloud.book.giftcoupon.enums.CouponTypeEnum
;
import
com.pcloud.book.giftcoupon.enums.CouponUseTypeEnum
;
import
com.pcloud.book.giftcoupon.enums.CouponUseTypeEnum
;
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.dao.RightsNowItemDao
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
com.pcloud.channelcenter.wechat.dto.AccountSettingDto
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.page.PageParam
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.ListUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.resourcecenter.product.dto.ProductDto
;
import
org.apache.commons.collections.MapUtils
;
import
org.apache.commons.collections.MapUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Random
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
@Component
(
"giftCouponPackageBiz"
)
@Component
(
"giftCouponPackageBiz"
)
...
@@ -46,6 +78,35 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -46,6 +78,35 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
private
GiftParamCheck
giftParamCheck
;
private
GiftParamCheck
giftParamCheck
;
@Autowired
@Autowired
private
AppletLinkClickDao
appletLinkClickDao
;
private
AppletLinkClickDao
appletLinkClickDao
;
@Autowired
private
AssistTempletConsr
assistTempletConsr
;
@Autowired
private
ProductConsr
productConsr
;
@Autowired
private
AppConsr
appConsr
;
@Autowired
private
QrcodeSceneConsr
qrcodeSceneConsr
;
@Autowired
private
AppletThirdResourcesBiz
appletThirdResourcesBiz
;
@Autowired
private
RightsNowItemDao
rightsNowItemDao
;
@Autowired
private
GiftCategoryDao
giftCategoryDao
;
@Autowired
private
LabelConsr
labelConsr
;
@Autowired
private
BookLabelBiz
bookLabelBiz
;
@Autowired
private
RightsSettingBiz
rightsSettingBiz
;
@Autowired
private
AppletUserBookcaseDao
appletUserBookcaseDao
;
@Autowired
private
AppletThirdResourcesDao
appletThirdResourcesDao
;
//将券库最大容量
private
final
Integer
COUPON_MAX_ALL_RECEIVE
=
10
;
private
final
Integer
COUPON_MAX_SHOW_SIZE
=
4
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
value
=
"新增专享礼包"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"新增专享礼包"
,
isAfterReturn
=
false
)
...
@@ -62,6 +123,13 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -62,6 +123,13 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
giftCouponPackage
.
setCoverPic
(
BookConstant
.
DEFAULT_COVER_PIC
);
giftCouponPackage
.
setCoverPic
(
BookConstant
.
DEFAULT_COVER_PIC
);
}
}
giftCouponPackageDao
.
insert
(
giftCouponPackage
);
giftCouponPackageDao
.
insert
(
giftCouponPackage
);
if
(!
ListUtils
.
isEmpty
(
giftCouponPackage
.
getGiftCategoryList
())){
giftCouponPackage
.
getGiftCategoryList
().
forEach
(
e
->{
e
.
setGiftPackageId
(
giftCouponPackage
.
getId
());
});
giftCategoryDao
.
batchCreate
(
giftCouponPackage
.
getGiftCategoryList
());
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
@@ -80,35 +148,170 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -80,35 +148,170 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getCoverPic
())){
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getCoverPic
())){
giftCouponPackage
.
setCoverPic
(
BookConstant
.
DEFAULT_COVER_PIC
);
giftCouponPackage
.
setCoverPic
(
BookConstant
.
DEFAULT_COVER_PIC
);
}
}
giftCategoryDao
.
deleteByPackageId
(
giftCouponPackage
.
getId
());
if
(!
ListUtils
.
isEmpty
(
giftCouponPackage
.
getGiftCategoryList
())){
giftCouponPackage
.
getGiftCategoryList
().
forEach
(
e
->{
e
.
setGiftPackageId
(
giftCouponPackage
.
getId
());
});
giftCategoryDao
.
batchCreate
(
giftCouponPackage
.
getGiftCategoryList
());
}
giftCouponPackageDao
.
update
(
giftCouponPackage
);
giftCouponPackageDao
.
update
(
giftCouponPackage
);
}
}
@Override
@Override
public
GiftCouponPackage
getGiftPackage
(
Long
id
)
{
public
GiftPackageDTO
getGiftPackage
(
Long
id
)
{
return
giftCouponPackageDao
.
getById
(
id
);
GiftPackageDTO
giftPackageDTO
=
giftCouponPackageDao
.
getByPackageId
(
id
);
if
(
null
==
giftPackageDTO
){
return
giftPackageDTO
;
}
giftPackageDTO
.
setDesc
(
StringUtils
.
isEmpty
(
giftPackageDTO
.
getResourceDesc
())
?
new
ArrayList
<>()
:
Arrays
.
stream
(
giftPackageDTO
.
getResourceDesc
().
split
(
","
)).
collect
(
Collectors
.
toList
()));
List
<
GiftPackageDTO
>
giftPackageDTOS
=
Arrays
.
asList
(
giftPackageDTO
);
//设置分类
fillCategory
(
giftPackageDTOS
);
//设置应用作品信息
fillAppProductInfo
(
giftPackageDTOS
);
//设置课程券第三方链接
giftPackageDTO
.
setAppletThirdResources
(
null
==
giftPackageDTO
.
getThirdResourceId
()
?
null
:
appletThirdResourcesDao
.
getByResourcesId
(
giftPackageDTO
.
getThirdResourceId
()));
return
giftPackageDTO
;
}
private
void
fillAppProductInfo
(
List
<
GiftPackageDTO
>
giftPackageDTOS
)
{
List
<
Long
>
productIds
=
giftPackageDTOS
.
stream
().
filter
(
a
->
null
!=
a
.
getServeId
()
&&
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
a
.
getServeType
())).
map
(
a
->
a
.
getServeId
()).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
appIds
=
giftPackageDTOS
.
stream
().
filter
(
a
->
null
!=
a
.
getServeId
()
&&
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
a
.
getServeType
())).
map
(
a
->
a
.
getServeId
()).
distinct
().
collect
(
Collectors
.
toList
());
Map
<
Long
,
ProductDto
>
productDtoMap
=!
ListUtils
.
isEmpty
(
productIds
)
?
productConsr
.
getProBasesByIds
(
productIds
)
:
new
HashMap
<>();
Map
<
Long
,
AppDto
>
appDtoMap
=!
ListUtils
.
isEmpty
(
appIds
)
?
appConsr
.
mapByIds4AuditPass
(
appIds
)
:
new
HashMap
<>();
ServeInfoDTO
serveInfoDTO
;
AccountSettingDto
accountSettingDto
;
List
<
GiftPackageDTO
>
list_remove
=
new
ArrayList
<>();
for
(
GiftPackageDTO
item
:
giftPackageDTOS
)
{
serveInfoDTO
=
new
ServeInfoDTO
();
serveInfoDTO
.
setServeType
(
item
.
getServeType
());
serveInfoDTO
.
setServeId
(
item
.
getServeId
());
if
(
AppAndProductTypeEnum
.
PRODUCT
.
value
.
equals
(
item
.
getServeType
()))
{
ProductDto
productDto
=
productDtoMap
.
get
(
item
.
getServeId
());
if
(
productDto
!=
null
)
{
serveInfoDTO
.
setServeName
(
productDto
.
getProductName
());
serveInfoDTO
.
setServePic
(
productDto
.
getCoverImg
());
if
(
productDto
.
getProductTypeDto
()
!=
null
)
{
serveInfoDTO
.
setServeTypeCode
(
productDto
.
getProductTypeDto
().
getTypeCode
());
serveInfoDTO
.
setServeTypeName
(
productDto
.
getProductTypeDto
().
getTypeName
());
}
//获取channelId,/C1404/product/display/10234028?adviserId=1001587&proType=MEMBER&source_type=QRCODE
Long
channelId
=
null
;
String
url
=
item
.
getLinkUrl
();
if
(
url
.
contains
(
"/C"
)
&&
!
url
.
startsWith
(
"https"
))
{
url
=
url
.
substring
(
url
.
indexOf
(
"/C"
)
+
2
);
url
=
url
.
substring
(
0
,
url
.
indexOf
(
"/"
));
if
(!
StringUtil
.
isEmpty
(
url
))
{
channelId
=
Long
.
valueOf
(
url
);
}
}
if
(
null
!=
channelId
)
{
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
channelId
);
if
(
null
==
accountSettingDto
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"运营平台未配置公众号"
);
}
String
resultLinkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
item
.
getLinkUrl
());
serveInfoDTO
.
setResultUrl
(
resultLinkUrl
);
}
else
{
serveInfoDTO
.
setResultUrl
(
item
.
getLinkUrl
());
}
if
(!
StringUtil
.
isEmpty
(
productDto
.
getSkipUrl
())){
serveInfoDTO
.
setHasThirdLink
(
true
);
}
else
{
serveInfoDTO
.
setHasThirdLink
(
false
);
}
}
}
if
(
AppAndProductTypeEnum
.
APP
.
value
.
equals
(
item
.
getServeType
()))
{
AppDto
appDto
=
appDtoMap
.
get
(
item
.
getServeId
());
if
(
appDto
!=
null
)
{
if
(!
StringUtil
.
isEmpty
(
appDto
.
getTurnUrl
())
&&
appDto
.
getTurnUrl
().
contains
(
"qrcode.5rs.me"
)
&&
"ARTICLE"
.
equals
(
appDto
.
getTypeCode
())){
list_remove
.
add
(
item
);
}
serveInfoDTO
.
setServeName
(
appDto
.
getTitle
());
serveInfoDTO
.
setServePic
(
appDto
.
getSquareImg
());
serveInfoDTO
.
setServeTypeCode
(
appDto
.
getTypeCode
());
serveInfoDTO
.
setServeTypeName
(
appDto
.
getTypeName
());
accountSettingDto
=
qrcodeSceneConsr
.
getWechatInfo
(
appDto
.
getChannelId
());
if
(
null
==
accountSettingDto
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"运营平台未配置公众号"
);
}
String
resultLinkUrl
=
SendWeixinRequestTools
.
splitUrl
(
accountSettingDto
,
item
.
getLinkUrl
());
serveInfoDTO
.
setResultUrl
(
resultLinkUrl
);
if
(!
StringUtil
.
isEmpty
(
appDto
.
getTurnUrl
())){
serveInfoDTO
.
setHasThirdLink
(
true
);
}
else
{
serveInfoDTO
.
setHasThirdLink
(
false
);
}
}
else
{
list_remove
.
add
(
item
);
//把要移除的统一放在一个集合
}
}
item
.
setServeInfoDTO
(
serveInfoDTO
);
}
}
}
@Override
@Override
public
void
deleteGiftPackage
(
Long
id
)
{
public
void
deleteGiftPackage
(
Long
id
)
{
//todo 删除应该有限制
//todo 删除应该有限制
giftCouponPackageDao
.
deleteById
(
id
);
giftCouponPackageDao
.
deleteById
(
id
);
//1 删除即享权益
rightsNowItemDao
.
deletePackageIds
(
Lists
.
newArrayList
(
id
));
}
}
@Override
@Override
public
PageBeanNew
<
GiftPackageDTO
>
list4GiftPackage
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Long
agentId
)
{
public
PageBeanNew
<
GiftPackageDTO
>
list4GiftPackage
(
String
title
,
Integer
state
,
Integer
couponType
,
Integer
currentPage
,
Integer
numPerPage
,
Long
agentId
,
Boolean
onShelves
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"title"
,
title
);
paramMap
.
put
(
"title"
,
title
);
paramMap
.
put
(
"state"
,
state
);
paramMap
.
put
(
"state"
,
state
);
paramMap
.
put
(
"couponType"
,
couponType
);
paramMap
.
put
(
"couponType"
,
couponType
);
paramMap
.
put
(
"agentId"
,
agentId
);
paramMap
.
put
(
"agentId"
,
agentId
);
paramMap
.
put
(
"onShelves"
,
onShelves
);
PageBeanNew
<
GiftPackageDTO
>
pageBeanNew
=
giftCouponPackageDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"list4GiftPackage"
);
PageBeanNew
<
GiftPackageDTO
>
pageBeanNew
=
giftCouponPackageDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"list4GiftPackage"
);
if
(
pageBeanNew
==
null
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
if
(
pageBeanNew
==
null
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
}
buildReceiveNum
(
pageBeanNew
.
getRecordList
());
buildReceiveNum
(
pageBeanNew
.
getRecordList
());
//填充分类信息
fillCategory
(
pageBeanNew
.
getRecordList
());
return
pageBeanNew
;
return
pageBeanNew
;
}
}
private
void
fillCategory
(
List
<
GiftPackageDTO
>
giftPackageDTOList
)
{
if
(
ListUtils
.
isEmpty
(
giftPackageDTOList
))
{
return
;
}
List
<
Long
>
packageIds
=
giftPackageDTOList
.
stream
().
map
(
a
->
a
.
getId
()).
collect
(
Collectors
.
toList
());
List
<
Long
>
classifyIds
=
giftCategoryDao
.
getTemplateIds
(
packageIds
);
List
<
Long
>
labels
=
giftCategoryDao
.
getLabels
(
packageIds
);
List
<
GiftCategoryDTO
>
giftCategoryDTOList
=
giftCategoryDao
.
getByPackageIds
(
packageIds
);
Map
<
Long
,
List
<
GiftCategoryDTO
>>
map
=
ListUtils
.
isEmpty
(
giftCategoryDTOList
)
?
new
HashMap
<>()
:
giftCategoryDTOList
.
stream
().
collect
(
Collectors
.
groupingBy
(
a
->
a
.
getGiftPackageId
()));
Map
<
Long
,
AssistTempletDTO
>
classifyMap
=
assistTempletConsr
.
mapByIds4Classify
(
classifyIds
);
Map
<
Long
,
String
>
labelMap
=
bookLabelBiz
.
getLabelMapByIds
(
labels
);
for
(
GiftPackageDTO
giftPackageDTO
:
giftPackageDTOList
)
{
if
(
MapUtils
.
isNotEmpty
(
map
)
&&
map
.
containsKey
(
giftPackageDTO
.
getId
())){
List
<
GiftCategoryDTO
>
giftCategoryDTOS
=
map
.
get
(
giftPackageDTO
.
getId
());
for
(
GiftCategoryDTO
categoryDTO
:
giftCategoryDTOS
)
{
if
(
MapUtils
.
isNotEmpty
(
classifyMap
)
&&
classifyMap
.
containsKey
(
categoryDTO
.
getFirstClassify
())){
categoryDTO
.
setFirstClassifyName
(
classifyMap
.
get
(
categoryDTO
.
getFirstClassify
()).
getTempletName
());
}
if
(
MapUtils
.
isNotEmpty
(
classifyMap
)
&&
classifyMap
.
containsKey
(
categoryDTO
.
getSecondClassify
())){
categoryDTO
.
setSecondClassifyName
(
classifyMap
.
get
(
categoryDTO
.
getSecondClassify
()).
getTempletName
());
}
if
(
MapUtils
.
isNotEmpty
(
labelMap
)
&&
labelMap
.
containsKey
(
categoryDTO
.
getSubjectLabelId
()))
{
categoryDTO
.
setSubjectLabelName
(
labelMap
.
get
(
categoryDTO
.
getSubjectLabelId
()));
}
if
(
MapUtils
.
isNotEmpty
(
labelMap
)
&&
labelMap
.
containsKey
(
categoryDTO
.
getGradeLabelId
()))
{
categoryDTO
.
setGradeLabelName
(
labelMap
.
get
(
categoryDTO
.
getGradeLabelId
()));
}
}
giftPackageDTO
.
setCategoryList
(
giftCategoryDTOS
);
}
}
}
private
void
buildReceiveNum
(
List
<
GiftPackageDTO
>
recordList
)
{
private
void
buildReceiveNum
(
List
<
GiftPackageDTO
>
recordList
)
{
List
<
Long
>
giftIds
=
recordList
.
stream
().
filter
(
a
->
null
!=
a
.
getId
()).
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
giftIds
=
recordList
.
stream
().
filter
(
a
->
null
!=
a
.
getId
()).
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
List
<
GiftReceiveDTO
>
giftReceiveNumList
=
ListUtils
.
isEmpty
(
giftIds
)?
new
ArrayList
<>():
giftReceiveDao
.
getGiftReceiveNumList
(
giftIds
);
List
<
GiftReceiveDTO
>
giftReceiveNumList
=
ListUtils
.
isEmpty
(
giftIds
)?
new
ArrayList
<>():
giftReceiveDao
.
getGiftReceiveNumList
(
giftIds
);
...
@@ -127,7 +330,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -127,7 +330,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
value
=
"新增专享礼包"
,
isAfterReturn
=
false
)
@ParamLog
(
value
=
"新增专享礼包"
,
isAfterReturn
=
false
)
@Override
@Override
public
void
createGiftReceive
(
GiftReceive
giftReceive
)
{
public
void
createGiftReceive
(
GiftReceive
giftReceive
)
throws
BookBizException
{
giftParamCheck
.
checkGiftReceiveAddParam
(
giftReceive
);
giftParamCheck
.
checkGiftReceiveAddParam
(
giftReceive
);
GiftCouponPackage
giftCouponPackage
=
giftCouponPackageDao
.
getById
(
giftReceive
.
getGiftPackageId
());
GiftCouponPackage
giftCouponPackage
=
giftCouponPackageDao
.
getById
(
giftReceive
.
getGiftPackageId
());
if
(
null
==
giftCouponPackage
){
if
(
null
==
giftCouponPackage
){
...
@@ -138,27 +341,53 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -138,27 +341,53 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
if
(
giftCouponPackage
.
getStock
()<
1
){
if
(
giftCouponPackage
.
getStock
()<
1
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"库存不够"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"库存不够"
);
}
}
giftCouponPackageDao
.
reduceStock
(
giftReceive
.
getGiftPackageId
());
//超过单个奖券领取上限
if
(
giftReceiveCount
>=
giftCouponPackage
.
getReceiveLimit
()){
if
(
giftReceiveCount
>=
giftCouponPackage
.
getReceiveLimit
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"该类型的兑换券您已经领取过,请前往“我的券库”使用吧"
);
throw
new
BookBizException
(
BookBizException
.
SUCCESS
,
"该类型的兑换券您已经领取过,请前往“我的券库”使用吧"
);
}
else
{
giftReceiveDao
.
insert
(
giftReceive
);
}
}
//超过券库总领取上限
Integer
giftAllReceiveCount
=
giftReceiveDao
.
getGiftAllReceiveCount
(
giftReceive
.
getWechatUserId
());
if
(
giftAllReceiveCount
>=
COUPON_MAX_ALL_RECEIVE
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"你的券库已达上限,请先去使用之后再领取吧!"
);
}
giftCouponPackageDao
.
reduceStock
(
giftReceive
.
getGiftPackageId
());
giftReceiveDao
.
insert
(
giftReceive
);
}
}
@Override
@Override
public
PageBeanNew
<
My
GiftPackageDTO
>
list4MyGiftPackage
(
Integer
state
,
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
)
{
public
PageBeanNew
<
GiftPackageDTO
>
list4MyGiftPackage
(
Integer
state
,
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
)
{
//state=1 已领取 state=2 已失效
//state=1 已领取 state=2 已失效
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"wechatUserId"
,
wechatUserId
);
paramMap
.
put
(
"wechatUserId"
,
wechatUserId
);
paramMap
.
put
(
"state"
,
state
);
paramMap
.
put
(
"state"
,
state
);
PageBeanNew
<
My
GiftPackageDTO
>
pageBeanNew
=
giftReceiveDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"list4MyGiftPackage"
);
PageBeanNew
<
GiftPackageDTO
>
pageBeanNew
=
giftReceiveDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"list4MyGiftPackage"
);
if
(
pageBeanNew
==
null
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
if
(
pageBeanNew
==
null
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
}
//设置应用作品信息
fillAppProductInfo
(
pageBeanNew
.
getRecordList
());
pageBeanNew
.
getRecordList
().
forEach
(
e
->{
e
.
setDesc
(
StringUtils
.
isEmpty
(
e
.
getResourceDesc
())
?
new
ArrayList
<>()
:
Arrays
.
stream
(
e
.
getResourceDesc
().
split
(
","
)).
collect
(
Collectors
.
toList
()));
});
//设置课程券第三方链接
setThirdResource
(
pageBeanNew
.
getRecordList
());
return
pageBeanNew
;
return
pageBeanNew
;
}
}
private
void
setThirdResource
(
List
<
GiftPackageDTO
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
List
<
Long
>
thirdResourceIds
=
list
.
stream
().
filter
(
a
->
null
!=
a
.
getThirdResourceId
()).
map
(
a
->
a
.
getThirdResourceId
()).
distinct
().
collect
(
Collectors
.
toList
());
List
<
AppletThirdResources
>
appletsByIds
=
ListUtils
.
isEmpty
(
thirdResourceIds
)
?
new
ArrayList
<>()
:
appletThirdResourcesBiz
.
getAppletsByIds
(
thirdResourceIds
);
Map
<
Long
,
AppletThirdResources
>
map
=
ListUtils
.
isEmpty
(
appletsByIds
)
?
new
HashMap
<>()
:
appletsByIds
.
stream
().
collect
(
Collectors
.
toMap
(
a
->
a
.
getId
(),
Function
.
identity
(),
(
k1
,
k2
)
->
k2
));
list
.
forEach
(
e
->{
if
(
MapUtils
.
isNotEmpty
(
map
)
&&
map
.
containsKey
(
e
.
getThirdResourceId
())){
e
.
setAppletThirdResources
(
map
.
get
(
e
.
getThirdResourceId
()));
}
});
}
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
useGiftCoupon
(
Long
wechatUserId
,
Long
receiveId
)
{
public
void
useGiftCoupon
(
Long
wechatUserId
,
Long
receiveId
)
{
...
@@ -191,6 +420,11 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -191,6 +420,11 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
if
(
noStockCount
>
0
)
{
if
(
noStockCount
>
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"有奖券包无库存,不能一键领取"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"有奖券包无库存,不能一键领取"
);
}
}
//超过券库总领取上限
Integer
giftAllReceiveCount
=
giftReceiveDao
.
getGiftAllReceiveCount
(
wechatUserId
);
if
(
giftAllReceiveCount
>=
COUPON_MAX_ALL_RECEIVE
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"你的券库已达上限,请先去使用之后再领取吧!"
);
}
//判断是否有超过上限的
//判断是否有超过上限的
List
<
GiftCouponPackage
>
overLimitCoupon
=
giftReceiveDao
.
getOverLimitCoupon
(
giftPackageIds
,
wechatUserId
);
List
<
GiftCouponPackage
>
overLimitCoupon
=
giftReceiveDao
.
getOverLimitCoupon
(
giftPackageIds
,
wechatUserId
);
if
(!
ListUtils
.
isEmpty
(
overLimitCoupon
)){
if
(!
ListUtils
.
isEmpty
(
overLimitCoupon
)){
...
@@ -287,4 +521,121 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -287,4 +521,121 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
return
exist
;
return
exist
;
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
batchUpdateGift
(
BatchUpdateDTO
batchUpdateDTO
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"onShelves"
,
batchUpdateDTO
.
getOnShelves
());
paramMap
.
put
(
"packageIds"
,
batchUpdateDTO
.
getPackageIds
());
//下架。解除和书的关系 立项权益里面要删除掉
if
(
batchUpdateDTO
.
getOperateType
()==
1
){
giftCouponPackageDao
.
batchUpdateGift
(
paramMap
);
if
(!
batchUpdateDTO
.
getOnShelves
()){
rightsNowItemDao
.
deletePackageIds
(
batchUpdateDTO
.
getPackageIds
());
}
}
//设置分类
if
(
batchUpdateDTO
.
getOperateType
()==
2
){
giftCategoryDao
.
deleteByPackageIds
(
batchUpdateDTO
.
getPackageIds
());
List
<
GiftCategory
>
list
=
new
ArrayList
<>();
GiftCategory
category
;
for
(
Long
packageId
:
batchUpdateDTO
.
getPackageIds
())
{
for
(
BaseTempletClassify
baseTempletClassify
:
batchUpdateDTO
.
getCategoryList
())
{
if
(
Objects
.
nonNull
(
baseTempletClassify
.
getFirstClassify
())){
rightsSettingBiz
.
setClassifyAndLabel
(
baseTempletClassify
);
category
=
new
GiftCategory
();
BeanUtils
.
copyProperties
(
baseTempletClassify
,
category
);
category
.
setGiftPackageId
(
packageId
);
list
.
add
(
category
);
}
}
}
giftCategoryDao
.
batchCreate
(
list
);
}
}
@Override
public
List
<
GiftPackageDTO
>
listGiftPackage4Wechat
(
Long
wechatUserId
)
{
BaseTempletClassify
baseTempletClassify
=
appletUserBookcaseDao
.
getLastReadBookInfo
(
wechatUserId
);
if
(
Objects
.
nonNull
(
baseTempletClassify
)
&&
Objects
.
nonNull
(
baseTempletClassify
.
getFirstClassify
()))
{
rightsSettingBiz
.
setClassifyAndLabel
(
baseTempletClassify
);
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"firstClassify"
,
null
!=
baseTempletClassify
?
baseTempletClassify
.
getFirstClassify
()
:
null
);
map
.
put
(
"secondClassify"
,
null
!=
baseTempletClassify
?
baseTempletClassify
.
getSecondClassify
()
:
null
);
map
.
put
(
"gradeLabelId"
,
null
!=
baseTempletClassify
?
baseTempletClassify
.
getGradeLabelId
()
:
null
);
map
.
put
(
"subjectLabelId"
,
null
!=
baseTempletClassify
?
baseTempletClassify
.
getSubjectLabelId
()
:
null
);
List
<
Long
>
resultIds
=
setSelectIds
(
map
);
if
(
ListUtils
.
isEmpty
(
resultIds
)){
return
new
ArrayList
<>();
}
List
<
GiftPackageDTO
>
giftPackageDTOS
=
giftCouponPackageDao
.
getGiftByIds
(
resultIds
);
if
(
ListUtils
.
isEmpty
(
giftPackageDTOS
)){
return
new
ArrayList
<>();
}
setHasReceived
(
wechatUserId
,
giftPackageDTOS
);
Map
<
Long
,
GiftPackageDTO
>
resultMap
=
giftPackageDTOS
.
stream
().
collect
(
Collectors
.
toMap
(
a
->
a
.
getId
(),
Function
.
identity
(),
(
k1
,
k2
)
->
k2
));
List
<
GiftPackageDTO
>
result
=
new
ArrayList
<>();
for
(
Long
resultId
:
resultIds
)
{
if
(
MapUtils
.
isNotEmpty
(
resultMap
)
&&
resultMap
.
containsKey
(
resultId
)){
result
.
add
(
resultMap
.
get
(
resultId
));
}
}
return
result
;
}
private
List
<
Long
>
setSelectIds
(
Map
<
String
,
Object
>
map
)
{
List
<
Long
>
list
=
giftCategoryDao
.
getByParams
(
map
);
Random
index
=
new
Random
();
List
<
Long
>
resultIds
=
new
ArrayList
<>();
List
<
Integer
>
indexList
=
new
ArrayList
<>();
if
(
list
.
size
()>=
COUPON_MAX_SHOW_SIZE
){
for
(
int
i
=
0
,
j
;
i
<
COUPON_MAX_SHOW_SIZE
;
i
++){
//获取在 list.size 返回内的随机数
j
=
index
.
nextInt
(
list
.
size
());
//判断是否重复
if
(!
indexList
.
contains
(
j
)){
//获取元素
indexList
.
add
(
j
);
resultIds
.
add
(
list
.
get
(
j
));
}
else
{
i
--;
//如果重复再来一次
}
}
}
else
{
if
(
ListUtils
.
isEmpty
(
list
)){
resultIds
.
addAll
(
list
);
}
List
<
Long
>
list1
=
giftCategoryDao
.
getOtherByParams
(
map
);
for
(
int
i
=
0
,
j
;
i
<
COUPON_MAX_SHOW_SIZE
-
list
.
size
();
i
++){
//获取在 list.size 返回内的随机数
j
=
index
.
nextInt
(
list1
.
size
());
//判断是否重复
if
(!
indexList
.
contains
(
j
)){
//获取元素
indexList
.
add
(
j
);
resultIds
.
add
(
list1
.
get
(
j
));
}
else
{
i
--;
//如果重复再来一次
}
}
}
return
resultIds
;
}
private
void
setHasReceived
(
Long
wechatUserId
,
List
<
GiftPackageDTO
>
list
)
{
if
(
ListUtils
.
isEmpty
(
list
)){
return
;
}
List
<
Long
>
packageIds
=
list
.
stream
().
map
(
a
->
a
.
getId
()).
distinct
().
collect
(
Collectors
.
toList
());
List
<
Long
>
receivedIds
=
ListUtils
.
isEmpty
(
packageIds
)
?
new
ArrayList
<>()
:
giftReceiveDao
.
getReceivedIds
(
packageIds
,
wechatUserId
);
for
(
GiftPackageDTO
giftPackageDTO
:
list
)
{
giftPackageDTO
.
setHasReceived
(
false
);
if
(!
ListUtils
.
isEmpty
(
receivedIds
)
&&
receivedIds
.
contains
(
giftPackageDTO
.
getId
())){
giftPackageDTO
.
setHasReceived
(
true
);
}
giftPackageDTO
.
setDesc
(
StringUtils
.
isEmpty
(
giftPackageDTO
.
getResourceDesc
())
?
new
ArrayList
<>()
:
Arrays
.
stream
(
giftPackageDTO
.
getResourceDesc
().
split
(
","
)).
collect
(
Collectors
.
toList
()));
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/check/GiftParamCheck.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
check
;
package
com
.
pcloud
.
book
.
giftcoupon
.
check
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.base.exception.BookBizException
;
import
com.pcloud.book.giftcoupon.dao.GiftCouponPackageDao
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.enums.CouponTypeEnum
;
import
com.pcloud.book.giftcoupon.enums.CouponTypeEnum
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.DateUtils
;
import
com.pcloud.common.utils.string.StringUtil
;
import
com.pcloud.common.utils.string.StringUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.util.Date
;
import
java.util.Date
;
...
@@ -24,6 +26,9 @@ public class GiftParamCheck {
...
@@ -24,6 +26,9 @@ public class GiftParamCheck {
private
final
Integer
COUPON_MAX_RECEIVE
=
5
;
private
final
Integer
COUPON_MAX_RECEIVE
=
5
;
private
final
Integer
COUPON_MIN_RECEIVE
=
1
;
private
final
Integer
COUPON_MIN_RECEIVE
=
1
;
@Autowired
private
GiftCouponPackageDao
giftCouponPackageDao
;
public
void
checkGiftAddParam
(
GiftCouponPackage
giftCouponPackage
)
{
public
void
checkGiftAddParam
(
GiftCouponPackage
giftCouponPackage
)
{
if
(
null
==
giftCouponPackage
)
{
if
(
null
==
giftCouponPackage
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数为空"
);
...
@@ -32,29 +37,32 @@ public class GiftParamCheck {
...
@@ -32,29 +37,32 @@ public class GiftParamCheck {
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"请选择礼券类型"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"请选择礼券类型"
);
}
}
if
(
StringUtil
.
isEmpty
(
giftCouponPackage
.
getTitle
()))
{
if
(
StringUtil
.
isEmpty
(
giftCouponPackage
.
getTitle
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
名
称为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
资源简
称为空"
);
}
}
if
(
giftCouponPackage
.
getTitle
().
length
()>
COUPON_MAX_TITLE_LENGTH
)
{
if
(
giftCouponPackage
.
getTitle
().
length
()>
COUPON_MAX_TITLE_LENGTH
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"标题名称最多"
+
COUPON_MAX_TITLE_LENGTH
+
"个字"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"标题名称最多"
+
COUPON_MAX_TITLE_LENGTH
+
"个字"
);
}
}
if
(
CouponTypeEnum
.
BOOK_COIN_COUPON
.
value
.
equals
(
giftCouponPackage
.
getCouponType
()))
{
if
(
CouponTypeEnum
.
BOOK_COIN_COUPON
.
value
.
equals
(
giftCouponPackage
.
getCouponType
()))
{
if
(
null
==
giftCouponPackage
.
getDenomination
())
{
/*
if (null == giftCouponPackage.getDenomination()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "面额为空");
throw new BookBizException(BookBizException.PARAM_IS_NULL, "面额为空");
}
}
if (giftCouponPackage.getDenomination() > COUPON_MAX_DENOMINATION) {
if (giftCouponPackage.getDenomination() > COUPON_MAX_DENOMINATION) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "面额最多"+COUPON_MAX_DENOMINATION);
throw new BookBizException(BookBizException.PARAM_IS_NULL, "面额最多"+COUPON_MAX_DENOMINATION);
}
}
*/
}
}
if
(
CouponTypeEnum
.
COURSE_COUPON
.
value
.
equals
(
giftCouponPackage
.
getCouponType
())){
if
(
CouponTypeEnum
.
COURSE_COUPON
.
value
.
equals
(
giftCouponPackage
.
getCouponType
())){
if
(
null
==
giftCouponPackage
.
getUseType
()){
if
(
null
==
giftCouponPackage
.
getUseType
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"使用方式为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"使用方式为空"
);
}
}
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getExchangeAddress
())){
if
(
null
==
giftCouponPackage
.
getThirdResourceId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"选择外链为空"
);
}
/* if(StringUtil.isBlank(giftCouponPackage.getExchangeAddress())){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "兑换地址为空");
throw new BookBizException(BookBizException.PARAM_IS_NULL, "兑换地址为空");
}
}
if(giftCouponPackage.getExchangeAddress().length()>COUPON_MAX_ADDRESS_LENGTH){
if(giftCouponPackage.getExchangeAddress().length()>COUPON_MAX_ADDRESS_LENGTH){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "兑换地址太长,最多"+COUPON_MAX_ADDRESS_LENGTH+"个字");
throw new BookBizException(BookBizException.PARAM_IS_NULL, "兑换地址太长,最多"+COUPON_MAX_ADDRESS_LENGTH+"个字");
}
}
*/
}
}
if
(
null
==
giftCouponPackage
.
getStock
())
{
if
(
null
==
giftCouponPackage
.
getStock
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"库存为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"库存为空"
);
...
@@ -65,11 +73,21 @@ public class GiftParamCheck {
...
@@ -65,11 +73,21 @@ public class GiftParamCheck {
if
(
null
==
giftCouponPackage
.
getReceiveLimit
())
{
if
(
null
==
giftCouponPackage
.
getReceiveLimit
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"领取上限为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"领取上限为空"
);
}
}
if
(
giftCouponPackage
.
getReceiveLimit
()>
COUPON_MAX_RECEIVE
)
{
if
(
CouponTypeEnum
.
BOOK_COIN_COUPON
.
value
.
equals
(
giftCouponPackage
.
getCouponType
())
||
CouponTypeEnum
.
COURSE_COUPON
.
value
.
equals
(
giftCouponPackage
.
getCouponType
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"领取上限最多"
+
COUPON_MAX_RECEIVE
+
"张"
);
if
(
giftCouponPackage
.
getReceiveLimit
()
>
COUPON_MAX_RECEIVE
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"领取上限最多"
+
COUPON_MAX_RECEIVE
+
"张"
);
}
if
(
giftCouponPackage
.
getReceiveLimit
()
<
COUPON_MIN_RECEIVE
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"领取上限最低"
+
COUPON_MIN_RECEIVE
+
"张"
);
}
}
}
if
(
giftCouponPackage
.
getReceiveLimit
()<
COUPON_MIN_RECEIVE
)
{
if
(
CouponTypeEnum
.
APP_PRODUCT
.
value
.
equals
(
giftCouponPackage
.
getCouponType
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"领取上限最低"
+
COUPON_MIN_RECEIVE
+
"张"
);
if
(
giftCouponPackage
.
getReceiveLimit
()
>
COUPON_MIN_RECEIVE
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"领取上限最多"
+
COUPON_MIN_RECEIVE
+
"张"
);
}
if
(
null
==
giftCouponPackage
.
getServeId
()){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"请选择应用或者作品"
);
}
}
}
if
(
StringUtil
.
isEmpty
(
giftCouponPackage
.
getValidDateBegin
())
||
StringUtil
.
isEmpty
(
giftCouponPackage
.
getValidDateEnd
()))
{
if
(
StringUtil
.
isEmpty
(
giftCouponPackage
.
getValidDateBegin
())
||
StringUtil
.
isEmpty
(
giftCouponPackage
.
getValidDateEnd
()))
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"有效期为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"有效期为空"
);
...
@@ -83,6 +101,18 @@ public class GiftParamCheck {
...
@@ -83,6 +101,18 @@ public class GiftParamCheck {
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getInstructions
())){
if
(
StringUtil
.
isBlank
(
giftCouponPackage
.
getInstructions
())){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"使用说明不能为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"使用说明不能为空"
);
}
}
if
(
null
==
giftCouponPackage
.
getRecToPage
()){
giftCouponPackage
.
setRecToPage
(
true
);
}
if
(
null
==
giftCouponPackage
.
getOnShelves
()){
giftCouponPackage
.
setOnShelves
(
true
);
}
if
(
StringUtil
.
isNotBlank
(
giftCouponPackage
.
getResourceNumber
())){
Integer
i
=
giftCouponPackageDao
.
getByResourceNumber
(
giftCouponPackage
.
getResourceNumber
(),
giftCouponPackage
.
getId
());
if
(
i
>
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"已存在相同的资源编号"
);
}
}
}
}
public
void
checkGiftReceiveAddParam
(
GiftReceive
giftReceive
)
{
public
void
checkGiftReceiveAddParam
(
GiftReceive
giftReceive
)
{
...
@@ -95,8 +125,8 @@ public class GiftParamCheck {
...
@@ -95,8 +125,8 @@ public class GiftParamCheck {
if
(
null
==
giftReceive
.
getGiftPackageId
())
{
if
(
null
==
giftReceive
.
getGiftPackageId
())
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"奖券包id为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"奖券包id为空"
);
}
}
if
(
null
==
giftReceive
.
getRightsSettingId
())
{
/*
if (null==giftReceive.getRightsSettingId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益id为空");
throw new BookBizException(BookBizException.PARAM_IS_NULL, "权益id为空");
}
}
*/
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/GiftCategoryDao.java
0 → 100644
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
;
import
com.pcloud.book.applet.dto.AppletNewsCategoryDTO
;
import
com.pcloud.book.applet.entity.AppletNewsCategory
;
import
com.pcloud.book.giftcoupon.dto.GiftCategoryDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCategory
;
import
com.pcloud.common.core.dao.BaseDao
;
import
java.util.List
;
import
java.util.Map
;
public
interface
GiftCategoryDao
extends
BaseDao
<
GiftCategory
>
{
void
batchCreate
(
List
<
GiftCategory
>
categoryList
);
void
deleteByPackageId
(
Long
giftPackageId
);
List
<
GiftCategoryDTO
>
getByPackageId
(
Long
giftPackageId
);
List
<
Long
>
getTemplateIds
(
List
<
Long
>
packageIds
);
List
<
Long
>
getLabels
(
List
<
Long
>
packageIds
);
List
<
GiftCategoryDTO
>
getByPackageIds
(
List
<
Long
>
packageIds
);
void
deleteByPackageIds
(
List
<
Long
>
packageIds
);
List
<
Long
>
getByParams
(
Map
<
String
,
Object
>
map
);
List
<
Long
>
getOtherByParams
(
Map
<
String
,
Object
>
map1
);
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/GiftCouponPackageDao.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
;
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.common.core.dao.BaseDao
;
import
com.pcloud.common.core.dao.BaseDao
;
...
@@ -35,4 +36,12 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
...
@@ -35,4 +36,12 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
* * @param null
* * @param null
*/
*/
Boolean
urlNumberExist
(
String
exchangeAddress
,
String
urlNumber
,
Long
id
,
Long
agentId
);
Boolean
urlNumberExist
(
String
exchangeAddress
,
String
urlNumber
,
Long
id
,
Long
agentId
);
void
batchUpdateGift
(
Map
<
String
,
Object
>
paramMap
);
GiftPackageDTO
getByPackageId
(
Long
id
);
Integer
getByResourceNumber
(
String
resourceNumber
,
Long
packageId
);
List
<
GiftPackageDTO
>
getGiftByIds
(
List
<
Long
>
packageIds
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/GiftReceiveDao.java
View file @
ff4ced8a
...
@@ -36,4 +36,7 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> {
...
@@ -36,4 +36,7 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> {
List
<
GiftCouponPackage
>
getOverLimitCoupon
(
List
<
Long
>
giftPackageIds
,
Long
wechatUserId
);
List
<
GiftCouponPackage
>
getOverLimitCoupon
(
List
<
Long
>
giftPackageIds
,
Long
wechatUserId
);
Integer
getGiftAllReceiveCount
(
Long
wechatUserId
);
List
<
Long
>
getReceivedIds
(
List
<
Long
>
packageIds
,
Long
wechatUserId
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/impl/GiftCategoryDaoImpl.java
0 → 100644
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
.
impl
;
import
com.pcloud.book.giftcoupon.dao.GiftCategoryDao
;
import
com.pcloud.book.giftcoupon.dto.GiftCategoryDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCategory
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
org.springframework.stereotype.Component
;
import
java.util.List
;
import
java.util.Map
;
@Component
public
class
GiftCategoryDaoImpl
extends
BaseDaoImpl
<
GiftCategory
>
implements
GiftCategoryDao
{
@Override
public
void
batchCreate
(
List
<
GiftCategory
>
categoryList
)
{
getSessionTemplate
().
insert
(
getStatement
(
"batchCreate"
),
categoryList
);
}
@Override
public
void
deleteByPackageId
(
Long
giftPackageId
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByPackageId"
),
giftPackageId
);
}
@Override
public
List
<
GiftCategoryDTO
>
getByPackageId
(
Long
giftPackageId
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getByPackageId"
),
giftPackageId
);
}
@Override
public
List
<
Long
>
getTemplateIds
(
List
<
Long
>
packageIds
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getTemplateIds"
),
packageIds
);
}
@Override
public
List
<
Long
>
getLabels
(
List
<
Long
>
packageIds
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getLabels"
),
packageIds
);
}
@Override
public
List
<
GiftCategoryDTO
>
getByPackageIds
(
List
<
Long
>
packageIds
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getByPackageIds"
),
packageIds
);
}
@Override
public
void
deleteByPackageIds
(
List
<
Long
>
packageIds
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deleteByPackageIds"
),
packageIds
);
}
@Override
public
List
<
Long
>
getByParams
(
Map
<
String
,
Object
>
map
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getByParams"
),
map
);
}
@Override
public
List
<
Long
>
getOtherByParams
(
Map
<
String
,
Object
>
map
)
{
return
getSessionTemplate
().
selectList
(
getStatement
(
"getOtherByParams"
),
map
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/impl/GiftCouponPackageDaoImpl.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
.
impl
;
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
.
impl
;
import
com.pcloud.book.giftcoupon.dao.GiftCouponPackageDao
;
import
com.pcloud.book.giftcoupon.dao.GiftCouponPackageDao
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
...
@@ -64,4 +65,29 @@ public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> imp
...
@@ -64,4 +65,29 @@ public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> imp
map
.
put
(
"agentId"
,
agentId
);
map
.
put
(
"agentId"
,
agentId
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"urlNumberExist"
),
map
);
return
getSessionTemplate
().
selectOne
(
getStatement
(
"urlNumberExist"
),
map
);
}
}
@Override
public
void
batchUpdateGift
(
Map
<
String
,
Object
>
paramMap
)
{
getSessionTemplate
().
update
(
getStatement
(
"batchUpdateGift"
),
paramMap
);
}
@Override
public
GiftPackageDTO
getByPackageId
(
Long
id
)
{
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByPackageId"
),
id
);
}
@Override
public
Integer
getByResourceNumber
(
String
resourceNumber
,
Long
packageId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"resourceNumber"
,
resourceNumber
);
map
.
put
(
"packageId"
,
packageId
);
return
super
.
getSqlSession
().
selectOne
(
getStatement
(
"getByResourceNumber"
),
map
);
}
@Override
public
List
<
GiftPackageDTO
>
getGiftByIds
(
List
<
Long
>
packageIds
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"packageIds"
,
packageIds
);
return
super
.
getSqlSession
().
selectList
(
getStatement
(
"getGiftByIds"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/impl/GiftReceiveDaoImpl.java
View file @
ff4ced8a
...
@@ -69,4 +69,18 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift
...
@@ -69,4 +69,18 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getOverLimitCoupon"
),
map
);
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getOverLimitCoupon"
),
map
);
}
}
@Override
public
Integer
getGiftAllReceiveCount
(
Long
wechatUserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
return
super
.
getSqlSession
().
selectOne
(
super
.
getStatement
(
"getGiftAllReceiveCount"
),
map
);
}
@Override
public
List
<
Long
>
getReceivedIds
(
List
<
Long
>
packageIds
,
Long
wechatUserId
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"giftPackageIds"
,
packageIds
);
return
super
.
getSqlSession
().
selectList
(
super
.
getStatement
(
"getReceivedIds"
),
map
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/BatchUpdateDTO.java
0 → 100644
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
import
com.pcloud.book.giftcoupon.entity.GiftCategory
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
java.util.List
;
import
javax.validation.constraints.NotNull
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
BatchUpdateDTO
{
@ApiModelProperty
(
"1-上下架,2-批量配置分类"
)
@NotNull
(
message
=
"批量操作字段不能为空"
)
private
Integer
operateType
;
@ApiModelProperty
(
"上下架"
)
private
Boolean
onShelves
;
@ApiModelProperty
(
"分类"
)
private
List
<
BaseTempletClassify
>
categoryList
;
@ApiModelProperty
(
"id集合"
)
@NotNull
(
message
=
"礼包券id不能为空"
)
private
List
<
Long
>
packageIds
;
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/ExceptionDTO.java
0 → 100644
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
import
java.util.List
;
import
lombok.Data
;
@Data
public
class
ExceptionDTO
{
String
errorMsg
;
public
ExceptionDTO
(
String
errorMsg
)
{
this
.
errorMsg
=
errorMsg
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/GiftCategoryDTO.java
0 → 100644
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
import
com.pcloud.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@EqualsAndHashCode
(
callSuper
=
true
)
@Data
@ApiModel
(
"小程序资讯类别"
)
public
class
GiftCategoryDTO
extends
BaseDto
{
@ApiModelProperty
(
"主键"
)
private
Long
id
;
@ApiModelProperty
(
"第一级类型标识"
)
private
Long
firstClassify
;
private
String
firstClassifyName
;
@ApiModelProperty
(
"第二级类型标识"
)
private
Long
secondClassify
;
private
String
secondClassifyName
;
@ApiModelProperty
(
"年级标签id"
)
private
Long
gradeLabelId
;
private
String
gradeLabelName
;
@ApiModelProperty
(
"科目标签id"
)
private
Long
subjectLabelId
;
private
String
subjectLabelName
;
private
Long
giftPackageId
;
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/GiftPackageDTO.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.applet.dto.AppletNewsCategoryDTO
;
import
com.pcloud.book.applet.entity.AppletThirdResources
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
@Data
@Data
public
class
GiftPackageDTO
{
public
class
GiftPackageDTO
{
/**
/**
*
封面图
*
主键id
*/
*/
private
Long
id
;
private
Long
id
;
/**
/**
...
@@ -25,7 +29,7 @@ public class GiftPackageDTO {
...
@@ -25,7 +29,7 @@ public class GiftPackageDTO {
* 有效期开始时间
* 有效期开始时间
*/
*/
@JsonFormat
(
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
,
timezone
=
"GMT+8"
timezone
=
"GMT+8"
)
)
private
Date
validDateBegin
;
private
Date
validDateBegin
;
...
@@ -33,7 +37,7 @@ public class GiftPackageDTO {
...
@@ -33,7 +37,7 @@ public class GiftPackageDTO {
* 有效期结束时间
* 有效期结束时间
*/
*/
@JsonFormat
(
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
,
timezone
=
"GMT+8"
timezone
=
"GMT+8"
)
)
private
Date
validDateEnd
;
private
Date
validDateEnd
;
...
@@ -58,6 +62,11 @@ public class GiftPackageDTO {
...
@@ -58,6 +62,11 @@ public class GiftPackageDTO {
private
Integer
receiveNum
;
private
Integer
receiveNum
;
/**
/**
* 未使用数量
*/
private
Integer
notUsedNum
;
/**
* 券类型(2-书币券,1-课程券)
* 券类型(2-书币券,1-课程券)
*/
*/
private
Integer
couponType
;
private
Integer
couponType
;
...
@@ -87,4 +96,94 @@ public class GiftPackageDTO {
...
@@ -87,4 +96,94 @@ public class GiftPackageDTO {
*/
*/
private
String
clickPVUV
;
private
String
clickPVUV
;
/**
* 资源编号
*/
private
String
resourceNumber
;
/**
* 资源价格
*/
private
String
price
;
/**
* 资源描述
*/
private
String
resourceDesc
;
/**
* 划线价
*/
private
String
crossedPrice
;
/**
* 是否推荐到首页
*/
private
Boolean
recToPage
;
/**
* 作品还是应用
*/
private
String
serveType
;
/**
* 应用或者作品id
*/
private
Long
serveId
;
private
String
linkUrl
;
/**
* 第三方资源链接id
*/
private
Long
thirdResourceId
;
/**
* 资源描述返回数组
*/
private
List
<
String
>
desc
;
/**
* 作品或者应用信息
*/
private
ServeInfoDTO
serveInfoDTO
;
/**
* 课程券第三方链接对象
*/
private
AppletThirdResources
appletThirdResources
;
/**
* 是否上架
*/
private
Boolean
onShelves
;
@ApiModelProperty
(
"适用类型"
)
private
List
<
GiftCategoryDTO
>
categoryList
;
/**
* 使用时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm"
,
timezone
=
"GMT+8"
)
private
Date
useTime
;
/**
* 领取id
*/
private
Long
receiveId
;
/**
* 失效状态 (1-已使用,2-已过期)
*/
private
Integer
failureState
;
@ApiModelProperty
(
"是否领取过"
)
private
Boolean
hasReceived
;
private
Long
agentId
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/MyGiftPackageDTO.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.pcloud.book.applet.entity.AppletThirdResources
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
lombok.Data
;
import
lombok.Data
;
@Data
@Data
public
class
MyGiftPackageDTO
{
public
class
MyGiftPackageDTO
{
/**
/**
* 券id
* 券id
...
@@ -85,5 +87,68 @@ public class MyGiftPackageDTO {
...
@@ -85,5 +87,68 @@ public class MyGiftPackageDTO {
*/
*/
private
Integer
failureState
;
private
Integer
failureState
;
/**
* 资源描述
*/
private
String
resourceDesc
;
/**
* 划线价
*/
private
String
crossedPrice
;
/**
* 应用于分类(分类id用逗号连接)
*/
private
String
applyType
;
/**
* 是否推荐到首页
*/
private
Boolean
recToPage
;
/**
* 作品还是应用
*/
private
String
serveType
;
/**
* 应用或者作品id
*/
private
Long
serveId
;
private
String
linkUrl
;
/**
* 第三方资源链接id
*/
private
Long
thirdResourceId
;
/**
* 应用于分类(分类中文用分号连接)
*/
private
String
applyTypeTemplate
;
/**
* 资源描述返回数组
*/
private
List
<
String
>
desc
;
/**
* 作品或者应用信息
*/
private
ServeInfoDTO
serveInfoDTO
;
/**
* 课程券第三方链接对象
*/
private
AppletThirdResources
appletThirdResources
;
/**
* 是否上架
*/
private
Boolean
onShelves
;
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/entity/GiftCategory.java
0 → 100644
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
entity
;
import
com.pcloud.book.rightsSetting.entity.BaseTempletClassify
;
import
java.util.Date
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
@ApiModel
(
"小程序资讯类别"
)
public
class
GiftCategory
extends
BaseTempletClassify
{
@ApiModelProperty
(
"主键"
)
private
Long
id
;
@ApiModelProperty
(
"礼券id"
)
private
Long
giftPackageId
;
@ApiModelProperty
(
"创建人"
)
private
Long
creator
;
@ApiModelProperty
(
"创建时间"
)
private
Date
createTime
;
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/entity/GiftCouponPackage.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
entity
;
package
com
.
pcloud
.
book
.
giftcoupon
.
entity
;
import
com.pcloud.book.applet.entity.AppletNewsCategory
;
import
com.pcloud.common.entity.BaseEntity
;
import
com.pcloud.common.entity.BaseEntity
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
...
@@ -64,4 +67,55 @@ public class GiftCouponPackage extends BaseEntity {
...
@@ -64,4 +67,55 @@ public class GiftCouponPackage extends BaseEntity {
private
String
urlNumber
;
private
String
urlNumber
;
private
Long
agentId
;
private
Long
agentId
;
/**
* 资源编号
*/
private
String
resourceNumber
;
/**
* 资源价格
*/
private
String
price
;
/**
* 资源描述
*/
private
String
resourceDesc
;
/**
* 划线价
*/
private
String
crossedPrice
;
/**
* 是否推荐到首页
*/
private
Boolean
recToPage
;
/**
* 作品还是应用
*/
private
String
serveType
;
private
String
linkUrl
;
/**
* 应用或者作品id
*/
private
Long
serveId
;
/**
* 第三方资源链接id
*/
private
Long
thirdResourceId
;
/**
* 是否上架
*/
private
Boolean
onShelves
;
@ApiModelProperty
(
"适用分类"
)
List
<
GiftCategory
>
GiftCategoryList
;
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/enums/CouponTypeEnum.java
View file @
ff4ced8a
...
@@ -12,7 +12,11 @@ public enum CouponTypeEnum {
...
@@ -12,7 +12,11 @@ public enum CouponTypeEnum {
/**
/**
* 书币券
* 书币券
*/
*/
BOOK_COIN_COUPON
(
2
);
BOOK_COIN_COUPON
(
2
),
/**
* 应用作品
*/
APP_PRODUCT
(
3
);
public
final
Integer
value
;
public
final
Integer
value
;
...
...
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/facade/GiftCouponPackageFacade.java
View file @
ff4ced8a
...
@@ -13,6 +13,8 @@ import com.pcloud.book.cultivate.entity.CultivateBookUser;
...
@@ -13,6 +13,8 @@ import com.pcloud.book.cultivate.entity.CultivateBookUser;
import
com.pcloud.book.cultivate.entity.CultivateRobotClassify
;
import
com.pcloud.book.cultivate.entity.CultivateRobotClassify
;
import
com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz
;
import
com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz
;
import
com.pcloud.book.giftcoupon.dto.BatchReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.BatchReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.BatchUpdateDTO
;
import
com.pcloud.book.giftcoupon.dto.ExceptionDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftReceiveDTO
;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO
;
...
@@ -27,6 +29,7 @@ import com.pcloud.common.utils.SessionUtil;
...
@@ -27,6 +29,7 @@ import com.pcloud.common.utils.SessionUtil;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.CookieValue
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
@@ -100,12 +103,22 @@ public class GiftCouponPackageFacade {
...
@@ -100,12 +103,22 @@ public class GiftCouponPackageFacade {
@RequestParam
(
value
=
"title"
,
required
=
false
)
@ApiParam
(
"礼包券名称"
)
String
title
,
@RequestParam
(
value
=
"title"
,
required
=
false
)
@ApiParam
(
"礼包券名称"
)
String
title
,
@RequestParam
(
value
=
"state"
,
required
=
false
)
@ApiParam
(
"状态"
)
Integer
state
,
@RequestParam
(
value
=
"state"
,
required
=
false
)
@ApiParam
(
"状态"
)
Integer
state
,
@RequestParam
(
value
=
"couponType"
,
required
=
false
)
@ApiParam
(
"券类型"
)
Integer
couponType
,
@RequestParam
(
value
=
"couponType"
,
required
=
false
)
@ApiParam
(
"券类型"
)
Integer
couponType
,
@RequestParam
(
value
=
"onShelves"
,
required
=
false
)
@ApiParam
(
"上下架"
)
Boolean
onShelves
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
)
throws
BizException
,
PermissionException
{
Map
<
String
,
Object
>
map
=
SessionUtil
.
getToken4Redis
(
token
);
Map
<
String
,
Object
>
map
=
SessionUtil
.
getToken4Redis
(
token
);
Long
agentId
=
(
Long
)
map
.
get
(
SessionUtil
.
RAY_AGENT_ID
);
Long
agentId
=
(
Long
)
map
.
get
(
SessionUtil
.
RAY_AGENT_ID
);
return
new
ResponseDto
<>(
giftCouponPackageBiz
.
list4GiftPackage
(
title
,
state
,
couponType
,
currentPage
,
numPerPage
,
agentId
));
return
new
ResponseDto
<>(
giftCouponPackageBiz
.
list4GiftPackage
(
title
,
state
,
couponType
,
currentPage
,
numPerPage
,
agentId
,
onShelves
));
}
@ApiOperation
(
"小程序首页礼券包"
)
@GetMapping
(
"/listGiftPackage4Wechat"
)
public
ResponseDto
<
List
<
GiftPackageDTO
>>
listGiftPackage4Wechat
(
@CookieValue
(
value
=
"userInfo"
)
String
userInfo
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
giftCouponPackageBiz
.
listGiftPackage4Wechat
(
wechatUserId
));
}
}
@ApiOperation
(
"新增礼券包领取"
)
@ApiOperation
(
"新增礼券包领取"
)
...
@@ -116,7 +129,11 @@ public class GiftCouponPackageFacade {
...
@@ -116,7 +129,11 @@ public class GiftCouponPackageFacade {
)
throws
BizException
,
PermissionException
{
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
GiftReceive
.
setWechatUserId
(
wechatUserId
);
GiftReceive
.
setWechatUserId
(
wechatUserId
);
giftCouponPackageBiz
.
createGiftReceive
(
GiftReceive
);
try
{
giftCouponPackageBiz
.
createGiftReceive
(
GiftReceive
);
}
catch
(
BookBizException
e
){
return
new
ResponseDto
<>(
e
.
getCode
(),
e
.
getMsg
(),
new
ExceptionDTO
(
e
.
getMsg
()));
}
return
new
ResponseDto
<>();
return
new
ResponseDto
<>();
}
}
...
@@ -133,7 +150,7 @@ public class GiftCouponPackageFacade {
...
@@ -133,7 +150,7 @@ public class GiftCouponPackageFacade {
@ApiOperation
(
"我的礼券包列表"
)
@ApiOperation
(
"我的礼券包列表"
)
@GetMapping
(
"/list4MyGiftPackage"
)
@GetMapping
(
"/list4MyGiftPackage"
)
public
ResponseDto
<
PageBeanNew
<
My
GiftPackageDTO
>>
list4MyGiftPackage
(
public
ResponseDto
<
PageBeanNew
<
GiftPackageDTO
>>
list4MyGiftPackage
(
@CookieValue
(
value
=
"userInfo"
)
String
userInfo
,
@CookieValue
(
value
=
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"state"
,
required
=
false
)
Integer
state
,
@RequestParam
(
value
=
"state"
,
required
=
false
)
Integer
state
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
...
@@ -180,4 +197,14 @@ public class GiftCouponPackageFacade {
...
@@ -180,4 +197,14 @@ public class GiftCouponPackageFacade {
return
new
ResponseDto
<>(
giftCouponPackageBiz
.
listGiftPackage4Analysis
(
title
,
state
,
couponType
,
currentPage
,
numPerPage
,
linkOnly
,
clickQty
,
agentId
));
return
new
ResponseDto
<>(
giftCouponPackageBiz
.
listGiftPackage4Analysis
(
title
,
state
,
couponType
,
currentPage
,
numPerPage
,
linkOnly
,
clickQty
,
agentId
));
}
}
@ApiOperation
(
"礼券包批量操作"
)
@PostMapping
(
"/batchUpdateGift"
)
public
ResponseDto
<?>
batchUpdateGift
(
@RequestHeader
(
"token"
)
String
token
,
@RequestBody
@Validated
BatchUpdateDTO
batchUpdateDTO
)
throws
BizException
,
PermissionException
{
Map
<
String
,
Object
>
map
=
SessionUtil
.
getToken4Redis
(
token
);
giftCouponPackageBiz
.
batchUpdateGift
(
batchUpdateDTO
);
return
new
ResponseDto
<>();
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/service/impl/GiftCouponServiceImpl.java
View file @
ff4ced8a
package
com
.
pcloud
.
book
.
giftcoupon
.
service
.
impl
;
package
com
.
pcloud
.
book
.
giftcoupon
.
service
.
impl
;
import
com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz
;
import
com.pcloud.book.giftcoupon.biz.GiftCouponPackageBiz
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.entity.GiftCouponPackage
;
import
com.pcloud.book.giftcoupon.service.GiftCouponService
;
import
com.pcloud.book.giftcoupon.service.GiftCouponService
;
import
com.pcloud.book.giftcoupon.vo.AppletThirdResourcesVo
;
import
com.pcloud.book.giftcoupon.vo.GiftCouponVo
;
import
com.pcloud.book.giftcoupon.vo.GiftCouponVo
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
...
@@ -27,9 +29,14 @@ public class GiftCouponServiceImpl implements GiftCouponService {
...
@@ -27,9 +29,14 @@ public class GiftCouponServiceImpl implements GiftCouponService {
@Override
@Override
@RequestMapping
(
value
=
"/getCouponBaseInfo"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/getCouponBaseInfo"
,
method
=
RequestMethod
.
GET
)
public
ResponseEntity
<
ResponseDto
<
GiftCouponVo
>>
getCouponBaseInfo
(
@RequestParam
(
"couponId"
)
Long
couponId
)
throws
BizException
{
public
ResponseEntity
<
ResponseDto
<
GiftCouponVo
>>
getCouponBaseInfo
(
@RequestParam
(
"couponId"
)
Long
couponId
)
throws
BizException
{
Gift
CouponPackage
giftPackage
=
giftCouponPackageBiz
.
getGiftPackage
(
couponId
);
Gift
PackageDTO
giftPackage
=
giftCouponPackageBiz
.
getGiftPackage
(
couponId
);
GiftCouponVo
giftCouponVo
=
new
GiftCouponVo
();
GiftCouponVo
giftCouponVo
=
new
GiftCouponVo
();
BeanUtils
.
copyProperties
(
giftPackage
,
giftCouponVo
);
BeanUtils
.
copyProperties
(
giftPackage
,
giftCouponVo
);
AppletThirdResourcesVo
appletThirdResources
=
new
AppletThirdResourcesVo
();
if
(
null
!=
giftPackage
.
getAppletThirdResources
()){
BeanUtils
.
copyProperties
(
giftPackage
.
getAppletThirdResources
(),
appletThirdResources
);
}
giftCouponVo
.
setAppletThirdResources
(
appletThirdResources
);
return
ResponseHandleUtil
.
toResponse
(
giftCouponVo
);
return
ResponseHandleUtil
.
toResponse
(
giftCouponVo
);
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/RightsNowItemDao.java
View file @
ff4ced8a
...
@@ -66,4 +66,10 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> {
...
@@ -66,4 +66,10 @@ public interface RightsNowItemDao extends BaseDao<RightsNowItem> {
* * @param null
* * @param null
*/
*/
List
<
RightsNowItem
>
getItemListByRightsSettingId
(
Long
rightsSettingId
,
Integer
rightsNowItemType
,
Integer
readType
,
Integer
openState
,
String
serveType
);
List
<
RightsNowItem
>
getItemListByRightsSettingId
(
Long
rightsSettingId
,
Integer
rightsNowItemType
,
Integer
readType
,
Integer
openState
,
String
serveType
);
/**
* 删除已经下架的礼券包
* @param packageIds
*/
void
deletePackageIds
(
List
<
Long
>
packageIds
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/rightsSetting/dao/impl/RightsNowItemDaoImpl.java
View file @
ff4ced8a
...
@@ -106,4 +106,8 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements
...
@@ -106,4 +106,8 @@ public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements
return
getSessionTemplate
().
selectList
(
getStatement
(
"getItemListByRightsSettingId"
),
map
);
return
getSessionTemplate
().
selectList
(
getStatement
(
"getItemListByRightsSettingId"
),
map
);
}
}
@Override
public
void
deletePackageIds
(
List
<
Long
>
packageIds
)
{
getSessionTemplate
().
delete
(
getStatement
(
"deletePackageIds"
),
packageIds
);
}
}
}
pcloud-service-book/src/main/resources/mapper/applet/AppletThirdResources.xml
View file @
ff4ced8a
...
@@ -97,6 +97,63 @@
...
@@ -97,6 +97,63 @@
from applet_third_resources where id=#{id}
from applet_third_resources where id=#{id}
</select>
</select>
<select
id=
"getByResourcesId"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.entity.AppletThirdResources"
>
select
a.id AS id,
a.resource_number AS number,
a.resource_type AS type,
a.resource_name AS name,
a.app_Id AS appletsId,
a.resource_source AS source,
a.resource_img_url AS resourceImgUrl,
a.resource_url AS url,
a.remark AS remark,
a.create_time AS creator,
a.update_time AS updator,
a.creator AS createTime,
a.updator AS updateTime,
a.route_code AS routeCode,
a.guide AS guide,
b.material_url AS materialUrl,
a.top_img_url topImgUrl,
a.float_img_url floatImgUrl,
a.button_img_url buttonImgUrl,
a.show_type showType
from applet_third_resources a
left join biz_material b on a.id = b.biz_id and b.biz_type = 1
where a.id=#{id}
</select>
<select
id=
"getAppletsByIds"
parameterType=
"map"
resultType=
"com.pcloud.book.applet.entity.AppletThirdResources"
>
select
a.id AS id,
a.resource_number AS number,
a.resource_type AS type,
a.resource_name AS name,
a.app_Id AS appletsId,
a.resource_source AS source,
a.resource_img_url AS resourceImgUrl,
a.resource_url AS url,
a.remark AS remark,
a.create_time AS creator,
a.update_time AS updator,
a.creator AS createTime,
a.updator AS updateTime,
a.route_code AS routeCode,
a.guide AS guide,
b.material_url AS materialUrl,
a.top_img_url topImgUrl,
a.float_img_url floatImgUrl,
a.button_img_url buttonImgUrl,
a.show_type showType
from applet_third_resources a
left join biz_material b on a.id = b.biz_id and b.biz_type = 1
where a.id in
<foreach
collection=
"ids"
item=
"item"
index=
"index"
separator=
","
close=
")"
open=
"("
>
#{item}
</foreach>
</select>
<select
id=
"getThirdResourcesByNewsId"
parameterType=
"Long"
resultType=
"com.pcloud.book.applet.entity.AppletThirdResources"
>
<select
id=
"getThirdResourcesByNewsId"
parameterType=
"Long"
resultType=
"com.pcloud.book.applet.entity.AppletThirdResources"
>
SELECT
SELECT
relation.from_id fromId,
relation.from_id fromId,
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletThirdResourcesClickMapper.xml
View file @
ff4ced8a
...
@@ -28,7 +28,8 @@
...
@@ -28,7 +28,8 @@
channel_id,
channel_id,
page,
page,
rights_setting_classify_id,
rights_setting_classify_id,
news_id
news_id,
gift_package_id
)
)
values (
values (
#{wechatUserId},
#{wechatUserId},
...
@@ -43,7 +44,8 @@
...
@@ -43,7 +44,8 @@
#{channelId},
#{channelId},
#{page},
#{page},
#{rightsSettingClassifyId},
#{rightsSettingClassifyId},
#{newsId}
#{newsId},
#{giftPackageId}
)
)
</insert>
</insert>
...
@@ -105,7 +107,8 @@
...
@@ -105,7 +107,8 @@
a.booK_id bookId,
a.booK_id bookId,
a.adviser_id adviserId,
a.adviser_id adviserId,
c.book_name bookName,
c.book_name bookName,
c.isbn
c.isbn,
a.gift_package_id giftPackageId
from
from
applet_thirdresources_click_record a
applet_thirdresources_click_record a
left join
left join
...
...
pcloud-service-book/src/main/resources/mapper/applet/AppletUserBookcase.xml
View file @
ff4ced8a
...
@@ -308,4 +308,20 @@
...
@@ -308,4 +308,20 @@
LIMIT 1
LIMIT 1
</select>
</select>
<select
id=
"getLastReadBookInfo"
parameterType=
"map"
resultType=
"com.pcloud.book.rightsSetting.entity.BaseTempletClassify"
>
SELECT b.TEMPLET_ID firstClassify,
b.SECOND_TEMPLET_ID secondClassify,
b.GRA_LABEL_ID gradeLabelId,
b.SUB_LABEL_ID subjectLabelId,
b.vol_label_id volLabelId
FROM applet_user_bookcase a
LEFT JOIN book_adviser b ON a.book_id = b.BOOK_ID
AND a.channel_id = b.CHANNEL_ID
AND a.adviser_id = b.ADVISER_ID
WHERE b.IS_DELETE = 0
AND a.wechat_user_id = #{wechatUserId}
ORDER BY a.create_time DESC
LIMIT 1
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftCategory.xml
0 → 100644
View file @
ff4ced8a
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.pcloud.book.giftcoupon.dao.impl.GiftCategoryDaoImpl"
>
<resultMap
id=
"BaseResultMap"
type=
"com.pcloud.book.giftcoupon.entity.GiftCategory"
>
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"gift_package_id"
property=
"giftPackageId"
jdbcType=
"BIGINT"
/>
<result
column=
"creator"
property=
"creator"
jdbcType=
"BIGINT"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"first_classify"
property=
"firstClassify"
jdbcType=
"BIGINT"
/>
<result
column=
"second_classify"
property=
"secondClassify"
jdbcType=
"BIGINT"
/>
<result
column=
"grade_label_id"
property=
"gradeLabelId"
jdbcType=
"BIGINT"
/>
<result
column=
"subject_label_id"
property=
"subjectLabelId"
jdbcType=
"BIGINT"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, gift_package_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id
</sql>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.giftcoupon.entity.GiftCategory"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into gift_category (
gift_package_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id
)
values (
#{giftPackageId}, #{creator}, NOW(), #{firstClassify}, #{secondClassify}, #{gradeLabelId}, #{subjectLabelId}
)
</insert>
<insert
id=
"batchCreate"
parameterType=
"list"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into gift_category (
gift_package_id, creator, create_time, first_classify,second_classify, grade_label_id, subject_label_id)
values
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
( #{item.giftPackageId}, #{item.creator}, NOW(), #{item.firstClassify}, #{item.secondClassify},
#{item.gradeLabelId}, #{item.subjectLabelId} )
</foreach>
</insert>
<select
id=
"getByPackageId"
parameterType=
"long"
resultType=
"com.pcloud.book.giftcoupon.dto.GiftCategoryDTO"
>
select
category.id,
category.gift_package_id,
category.first_classify firstClassify,
category.second_classify secondClassify,
category.grade_label_id gradeLabelId,
category.subject_label_id subjectLabelId,
label.name gradeLabelName,
label2.name subjectLabelName
from gift_category category
LEFT JOIN book_label label ON category.grade_label_id = label.id AND label.type=1
LEFT JOIN book_label label2 ON category.subject_label_id = label2.id AND label2.type=2
where gift_package_id=#{giftPackageId}
</select>
<select
id=
"getByPackageIds"
parameterType=
"list"
resultType=
"com.pcloud.book.giftcoupon.dto.GiftCategoryDTO"
>
select
category.id,
category.gift_package_id giftPackageId,
category.first_classify firstClassify,
category.second_classify secondClassify,
category.grade_label_id gradeLabelId,
category.subject_label_id subjectLabelId
from gift_category category
where gift_package_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
<delete
id=
"deleteByPackageId"
parameterType=
"long"
>
DELETE FROM gift_category
WHERE gift_package_id = #{giftPackageId}
</delete>
<select
id=
"getTemplateIds"
parameterType=
"list"
resultType=
"Long"
>
select first_classify from
gift_category
where gift_package_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
and first_classify>0
union
select second_classify from
gift_category
where gift_package_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
and second_classify>0
</select>
<select
id=
"getLabels"
parameterType=
"list"
resultType=
"Long"
>
select grade_label_id from
gift_category
where gift_package_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
and grade_label_id>0
union
select subject_label_id from
gift_category
where gift_package_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
and subject_label_id>0
</select>
<delete
id=
"deleteByPackageIds"
parameterType=
"list"
>
DELETE FROM gift_category
WHERE gift_package_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</delete>
<select
id=
"getByParams"
parameterType=
"map"
resultType=
"Long"
>
select
a.id
from
gift_coupon_package a
INNER JOIN (
select DISTINCT gift_package_id from
gift_category
where
first_classify =#{firstClassify}
<if
test=
"gradeLabelId!=null"
>
AND grade_label_id = #{gradeLabelId}
</if>
<if
test=
"gradeLabelId==null"
>
AND grade_label_id is null
</if>
<if
test=
"subjectLabelId!=null"
>
AND subject_label_id = #{subjectLabelId}
</if>
<if
test=
"subjectLabelId==null"
>
AND subject_label_id is null
</if>
)t on a.id=t.gift_package_id
where a.is_delete=0
and a.stock>0
and a.on_shelves=1
and a.rec_to_page=1
and now()
<![CDATA[ < ]]>
a.valid_date_end
</select>
<select
id=
"getOtherByParams"
parameterType=
"map"
resultType=
"Long"
>
select
a.id
from
gift_coupon_package a
where a.is_delete=0
and a.stock>0
and a.on_shelves=1
and now()
<![CDATA[ < ]]>
a.valid_date_end
and a.id not in
(
select DISTINCT gift_package_id from
gift_category
)
</select>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftCouplePackageDao.xml
View file @
ff4ced8a
...
@@ -19,11 +19,49 @@
...
@@ -19,11 +19,49 @@
<result
property=
"exchangeAddress"
column=
"exchange_address"
jdbcType=
"VARCHAR"
/>
<result
property=
"exchangeAddress"
column=
"exchange_address"
jdbcType=
"VARCHAR"
/>
<result
property=
"urlNumber"
column=
"url_number"
jdbcType=
"VARCHAR"
/>
<result
property=
"urlNumber"
column=
"url_number"
jdbcType=
"VARCHAR"
/>
<result
property=
"agentId"
column=
"agent_id"
jdbcType=
"BIGINT"
/>
<result
property=
"agentId"
column=
"agent_id"
jdbcType=
"BIGINT"
/>
<result
property=
"resourceNumber"
column=
"resource_number"
jdbcType=
"VARCHAR"
/>
<result
property=
"resourceDesc"
column=
"resource_desc"
jdbcType=
"VARCHAR"
/>
<result
property=
"price"
column=
"price"
jdbcType=
"VARCHAR"
/>
<result
property=
"crossedPrice"
column=
"crossed_price"
jdbcType=
"VARCHAR"
/>
<result
property=
"recToPage"
column=
"rec_to_page"
jdbcType=
"BOOLEAN"
/>
<result
property=
"serveType"
column=
"serve_type"
jdbcType=
"VARCHAR"
/>
<result
property=
"linkUrl"
column=
"link_url"
jdbcType=
"VARCHAR"
/>
<result
property=
"serveId"
column=
"serve_id"
jdbcType=
"BIGINT"
/>
<result
property=
"thirdResourceId"
column=
"third_resource_id"
jdbcType=
"BIGINT"
/>
<result
property=
"onShelves"
column=
"on_shelves"
jdbcType=
"BOOLEAN"
/>
</resultMap>
<resultMap
type=
"com.pcloud.book.giftcoupon.dto.GiftPackageDTO"
id=
"GiftCouplePackageDtoMap"
>
<result
property=
"id"
column=
"id"
jdbcType=
"INTEGER"
/>
<result
property=
"coverPic"
column=
"cover_pic"
jdbcType=
"VARCHAR"
/>
<result
property=
"title"
column=
"title"
jdbcType=
"VARCHAR"
/>
<result
property=
"validDateBegin"
column=
"valid_date_begin"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"validDateEnd"
column=
"valid_date_end"
jdbcType=
"TIMESTAMP"
/>
<result
property=
"denomination"
column=
"denomination"
jdbcType=
"INTEGER"
/>
<result
property=
"stock"
column=
"stock"
jdbcType=
"INTEGER"
/>
<result
property=
"receiveLimit"
column=
"receive_limit"
jdbcType=
"INTEGER"
/>
<result
property=
"couponType"
column=
"coupon_type"
jdbcType=
"INTEGER"
/>
<result
property=
"instructions"
column=
"instructions"
jdbcType=
"VARCHAR"
/>
<result
property=
"useType"
column=
"use_type"
jdbcType=
"INTEGER"
/>
<result
property=
"exchangeAddress"
column=
"exchange_address"
jdbcType=
"VARCHAR"
/>
<result
property=
"urlNumber"
column=
"url_number"
jdbcType=
"VARCHAR"
/>
<result
property=
"agentId"
column=
"agent_id"
jdbcType=
"BIGINT"
/>
<result
property=
"resourceNumber"
column=
"resource_number"
jdbcType=
"VARCHAR"
/>
<result
property=
"resourceDesc"
column=
"resource_desc"
jdbcType=
"VARCHAR"
/>
<result
property=
"price"
column=
"price"
jdbcType=
"VARCHAR"
/>
<result
property=
"crossedPrice"
column=
"crossed_price"
jdbcType=
"VARCHAR"
/>
<result
property=
"recToPage"
column=
"rec_to_page"
jdbcType=
"BOOLEAN"
/>
<result
property=
"serveType"
column=
"serve_type"
jdbcType=
"VARCHAR"
/>
<result
property=
"linkUrl"
column=
"link_url"
jdbcType=
"VARCHAR"
/>
<result
property=
"serveId"
column=
"serve_id"
jdbcType=
"BIGINT"
/>
<result
property=
"thirdResourceId"
column=
"third_resource_id"
jdbcType=
"BIGINT"
/>
<result
property=
"onShelves"
column=
"on_shelves"
jdbcType=
"BOOLEAN"
/>
</resultMap>
</resultMap>
<sql
id=
"Base_Column_List"
>
<sql
id=
"Base_Column_List"
>
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address, url_number, agent_id
coupon_type,instructions,use_type,exchange_address, url_number, agent_id,resource_number,resource_desc,
price,crossed_price,rec_to_page,serve_type,serve_id,third_resource_id,link_url,on_shelves
</sql>
</sql>
<!--查询单个-->
<!--查询单个-->
...
@@ -90,9 +128,11 @@
...
@@ -90,9 +128,11 @@
<!--新增所有列-->
<!--新增所有列-->
<insert
id=
"insert"
parameterType=
"com.pcloud.book.giftcoupon.entity.GiftCouponPackage"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
<insert
id=
"insert"
parameterType=
"com.pcloud.book.giftcoupon.entity.GiftCouponPackage"
keyProperty=
"id"
useGeneratedKeys=
"true"
>
insert into book.gift_coupon_package(cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
insert into book.gift_coupon_package(cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address,url_number, agent_id)
coupon_type,instructions,use_type,exchange_address,url_number, agent_id,resource_number,resource_desc,
price,crossed_price,rec_to_page,serve_type,serve_id,third_resource_id,link_url,on_shelves)
values (#{coverPic}, #{title}, #{validDateBegin}, #{validDateEnd}, #{denomination}, #{stock}, #{receiveLimit}, now(), now(), 0,
values (#{coverPic}, #{title}, #{validDateBegin}, #{validDateEnd}, #{denomination}, #{stock}, #{receiveLimit}, now(), now(), 0,
#{couponType},#{instructions},#{useType},#{exchangeAddress}, #{urlNumber}, #{agentId})
#{couponType},#{instructions},#{useType},#{exchangeAddress}, #{urlNumber}, #{agentId},#{resourceNumber},#{resourceDesc},#{price}
,#{crossedPrice},#{recToPage},#{serveType},#{serveId},#{thirdResourceId},#{linkUrl},#{onShelves})
</insert>
</insert>
<!--通过主键修改数据-->
<!--通过主键修改数据-->
...
@@ -138,6 +178,30 @@
...
@@ -138,6 +178,30 @@
<if
test=
"urlNumber != null"
>
<if
test=
"urlNumber != null"
>
url_number = #{urlNumber},
url_number = #{urlNumber},
</if>
</if>
resource_number = #{resourceNumber},
<if
test=
"resourceDesc != null"
>
resource_desc = #{resourceDesc},
</if>
price = #{price},
crossed_price = #{crossedPrice},
<if
test=
"recToPage != null"
>
rec_to_page = #{recToPage},
</if>
<if
test=
"serveType != null"
>
serve_type = #{serveType},
</if>
<if
test=
"serveId != null"
>
serve_id = #{serveId},
</if>
<if
test=
"linkUrl != null"
>
link_url = #{linkUrl},
</if>
<if
test=
"thirdResourceId != null"
>
third_resource_id = #{thirdResourceId},
</if>
<if
test=
"onShelves != null"
>
on_shelves = #{onShelves},
</if>
update_time = now()
update_time = now()
</set>
</set>
where id = #{id}
where id = #{id}
...
@@ -163,13 +227,16 @@
...
@@ -163,13 +227,16 @@
a.instructions instructions,
a.instructions instructions,
a.use_type useType,
a.use_type useType,
a.exchange_address exchangeAddress,
a.exchange_address exchangeAddress,
a.url_number urlNumber
a.url_number urlNumber,
a.resource_number resourceNumber,
a.rec_to_page recToPage,
a.on_shelves onShelves
from
from
gift_coupon_package a
gift_coupon_package a
where a.is_delete=0
where a.is_delete=0
and a.stock>0
and a.stock>0
<if
test=
"title !=null and title !=''"
>
<if
test=
"title !=null and title !=''"
>
and
a.title like concat('%',#{title},'%'
)
and
(a.title like concat('%',#{title},'%') or a.resource_number like concat('%',#{title},'%')
)
</if>
</if>
<if
test=
"state !=null and state==1"
>
<if
test=
"state !=null and state==1"
>
and now()
<![CDATA[ < ]]>
a.valid_date_begin
and now()
<![CDATA[ < ]]>
a.valid_date_begin
...
@@ -186,6 +253,9 @@
...
@@ -186,6 +253,9 @@
<if
test=
"couponType !=null"
>
<if
test=
"couponType !=null"
>
and a.coupon_type=#{couponType}
and a.coupon_type=#{couponType}
</if>
</if>
<if
test=
"onShelves !=null"
>
and a.on_shelves=#{onShelves}
</if>
and a.receive_limit>0
and a.receive_limit>0
<choose>
<choose>
<when
test=
"agentId != null"
>
<when
test=
"agentId != null"
>
...
@@ -195,7 +265,6 @@
...
@@ -195,7 +265,6 @@
and a.agent_id = 0
and a.agent_id = 0
</otherwise>
</otherwise>
</choose>
</choose>
GROUP BY a.id
order by a.update_time desc
order by a.update_time desc
</select>
</select>
...
@@ -343,5 +412,61 @@
...
@@ -343,5 +412,61 @@
order by a.update_time desc
order by a.update_time desc
</select>
</select>
<update
id=
"batchUpdateGift"
parameterType=
"map"
>
update gift_coupon_package
set on_shelves=#{onShelves},
update_time=now()
where id in
<foreach
collection=
"packageIds"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</update>
<select
id=
"getByPackageId"
parameterType=
"Long"
resultMap=
"GiftCouplePackageDtoMap"
>
select
<include
refid=
"Base_Column_List"
/>
from book.gift_coupon_package
where id = #{id}
and is_delete=0
</select>
<select
id=
"getByResourceNumber"
parameterType=
"map"
resultType=
"Integer"
>
select ifnull(count(1),0)
from gift_coupon_package
where resource_number=#{resourceNumber}
<if
test=
"packageId !=null"
>
and id !=#{packageId}
</if>
</select>
<select
id=
"getGiftByIds"
parameterType=
"map"
resultType=
"com.pcloud.book.giftcoupon.dto.GiftPackageDTO"
>
select
a.id id,
a.title title,
a.cover_pic coverPic,
a.denomination denomination,
a.receive_limit receiveLimit,
a.stock stock,
a.valid_date_begin validDateBegin,
a.valid_date_end validDateEnd,
if(NOW()
<![CDATA[ < ]]>
a.valid_date_begin,1,if(NOW() between a.valid_date_begin and a.valid_date_end,2,3)) state,
a.coupon_type couponType,
a.instructions instructions,
a.use_type useType,
a.exchange_address exchangeAddress,
a.url_number urlNumber,
a.resource_number resourceNumber,
a.rec_to_page recToPage,
a.resource_desc resourceDesc,
a.price price,
a.crossed_price crossedPrice,
a.on_shelves onShelves
from
gift_coupon_package a
where a.id in
<foreach
collection=
"packageIds"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftReceiveDao.xml
View file @
ff4ced8a
...
@@ -128,7 +128,7 @@
...
@@ -128,7 +128,7 @@
where id=#{receiveId}
where id=#{receiveId}
</select>
</select>
<select
id=
"list4MyGiftPackage"
parameterType=
"map"
resultType=
"com.pcloud.book.giftcoupon.dto.
My
GiftPackageDTO"
>
<select
id=
"list4MyGiftPackage"
parameterType=
"map"
resultType=
"com.pcloud.book.giftcoupon.dto.GiftPackageDTO"
>
select
select
b.id receiveId,
b.id receiveId,
b.use_time useTime,
b.use_time useTime,
...
@@ -141,8 +141,16 @@
...
@@ -141,8 +141,16 @@
a.coupon_type couponType,
a.coupon_type couponType,
a.instructions instructions,
a.instructions instructions,
a.use_type useType,
a.use_type useType,
a.resource_desc resourceDesc,
a.price price,
a.crossed_price crossedPrice,
a.exchange_address exchangeAddress,
a.exchange_address exchangeAddress,
if(b.use_time>0,1,2) failureState
if(b.use_time>0,1,2) failureState,
a.serve_id serveId,
a.serve_type serveType,
a.link_url linkUrl,
a.third_resource_id thirdResourceId,
a.on_shelves onShelves
from
from
gift_receive b LEFT JOIN gift_coupon_package a
gift_receive b LEFT JOIN gift_coupon_package a
on a.id=b.gift_package_id
on a.id=b.gift_package_id
...
@@ -198,5 +206,24 @@
...
@@ -198,5 +206,24 @@
GROUP BY a.gift_package_id HAVING count(a.id)>=b.receive_limit
GROUP BY a.gift_package_id HAVING count(a.id)>=b.receive_limit
</select>
</select>
<select
id=
"getGiftAllReceiveCount"
parameterType=
"map"
resultType=
"Integer"
>
select ifnull(count(1),0)
from gift_receive a
left join gift_coupon_package b
on a.gift_package_id=b.id
where a.wechat_user_id=#{wechatUserId}
and a.use_time is null
and b.valid_date_end > now()
</select>
<select
id=
"getReceivedIds"
parameterType=
"map"
resultType=
"Long"
>
select distinct gift_package_id
from gift_receive
where wechat_user_id=#{wechatUserId}
and gift_package_id in
<foreach
collection=
"giftPackageIds"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
${item}
</foreach>
</select>
</mapper>
</mapper>
\ No newline at end of file
pcloud-service-book/src/main/resources/mapper/rightssetting/RightNowItem.xml
View file @
ff4ced8a
...
@@ -304,4 +304,17 @@
...
@@ -304,4 +304,17 @@
ORDER BY d.id
ORDER BY d.id
</select>
</select>
<delete
id=
"deletePackageIds"
parameterType=
"list"
>
delete
from
rights_now_item
where
serve_type = "GIFT"
and
gift_coupon_package_id in
<foreach
collection=
"list"
item=
"item"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</delete>
</mapper>
</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