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
fc8825e0
Commit
fc8825e0
authored
Apr 20, 2020
by
裴大威
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat-zy-1002779' into 'master'
去掉券包图片验证 See merge request rays/pcloud-book!646
parents
1c76296d
0c19fdae
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
200 additions
and
40 deletions
+200
-40
GiftCouponPackageBiz.java
.../com/pcloud/book/giftcoupon/biz/GiftCouponPackageBiz.java
+5
-0
GiftCouponPackageBizImpl.java
...ud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
+46
-2
GiftParamCheck.java
...java/com/pcloud/book/giftcoupon/check/GiftParamCheck.java
+0
-3
GiftReceiveDao.java
...n/java/com/pcloud/book/giftcoupon/dao/GiftReceiveDao.java
+3
-23
GiftReceiveDaoImpl.java
...m/pcloud/book/giftcoupon/dao/impl/GiftReceiveDaoImpl.java
+11
-8
GiftReceiveDTO.java
...n/java/com/pcloud/book/giftcoupon/dto/GiftReceiveDTO.java
+24
-0
MyGiftPackageDTO.java
...java/com/pcloud/book/giftcoupon/dto/MyGiftPackageDTO.java
+49
-0
GiftCouponPackageFacade.java
...cloud/book/giftcoupon/facade/GiftCouponPackageFacade.java
+25
-1
GiftCouplePackageDao.xml
...main/resources/mapper/giftConpon/GiftCouplePackageDao.xml
+1
-3
GiftReceiveDao.xml
...k/src/main/resources/mapper/giftConpon/GiftReceiveDao.xml
+36
-0
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/GiftCouponPackageBiz.java
View file @
fc8825e0
package
com
.
pcloud
.
book
.
giftcoupon
.
biz
;
package
com
.
pcloud
.
book
.
giftcoupon
.
biz
;
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.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
;
...
@@ -17,4 +18,8 @@ public interface GiftCouponPackageBiz {
...
@@ -17,4 +18,8 @@ public interface GiftCouponPackageBiz {
void
createGiftReceive
(
GiftReceive
giftReceive
);
void
createGiftReceive
(
GiftReceive
giftReceive
);
PageBeanNew
<
GiftPackageDTO
>
list4GiftPackage
(
String
title
,
Integer
state
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
GiftPackageDTO
>
list4GiftPackage
(
String
title
,
Integer
state
,
Integer
currentPage
,
Integer
numPerPage
);
PageBeanNew
<
MyGiftPackageDTO
>
list4MyGiftPackage
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
);
void
useGiftCoupon
(
Long
wechatUserId
,
Long
giftPackageId
);
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
View file @
fc8825e0
...
@@ -6,6 +6,8 @@ import com.pcloud.book.giftcoupon.check.GiftParamCheck;
...
@@ -6,6 +6,8 @@ import com.pcloud.book.giftcoupon.check.GiftParamCheck;
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.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftReceiveDTO
;
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.core.aspect.ParamLog
;
import
com.pcloud.common.core.aspect.ParamLog
;
...
@@ -13,13 +15,16 @@ import com.pcloud.common.page.PageBeanNew;
...
@@ -13,13 +15,16 @@ 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
org.apache.commons.collections.MapUtils
;
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
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@Component
(
"giftCouponPackageBiz"
)
@Component
(
"giftCouponPackageBiz"
)
public
class
GiftCouponPackageBizImpl
implements
GiftCouponPackageBiz
{
public
class
GiftCouponPackageBizImpl
implements
GiftCouponPackageBiz
{
...
@@ -32,7 +37,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -32,7 +37,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
private
GiftParamCheck
giftParamCheck
;
private
GiftParamCheck
giftParamCheck
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"新增专享礼包"
)
@ParamLog
(
value
=
"新增专享礼包"
,
isAfterReturn
=
false
)
@Override
@Override
public
void
createGiftPackage
(
GiftCouponPackage
giftCouponPackage
)
{
public
void
createGiftPackage
(
GiftCouponPackage
giftCouponPackage
)
{
giftParamCheck
.
checkGiftAddParam
(
giftCouponPackage
);
giftParamCheck
.
checkGiftAddParam
(
giftCouponPackage
);
...
@@ -40,7 +45,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -40,7 +45,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"修改专享礼包"
)
@ParamLog
(
value
=
"修改专享礼包"
,
isAfterReturn
=
false
)
@Override
@Override
public
void
updateGiftPackage
(
GiftCouponPackage
giftCouponPackage
)
{
public
void
updateGiftPackage
(
GiftCouponPackage
giftCouponPackage
)
{
giftParamCheck
.
checkGiftAddParam
(
giftCouponPackage
);
giftParamCheck
.
checkGiftAddParam
(
giftCouponPackage
);
...
@@ -67,9 +72,25 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -67,9 +72,25 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
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
());
return
pageBeanNew
;
return
pageBeanNew
;
}
}
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
<
GiftReceiveDTO
>
giftReceiveNumList
=
ListUtils
.
isEmpty
(
giftIds
)?
new
ArrayList
<>():
giftReceiveDao
.
getGiftReceiveNumList
(
giftIds
);
Map
<
Long
,
Integer
>
receiveNumMap
=
new
HashMap
<>();
if
(!
ListUtils
.
isEmpty
(
giftReceiveNumList
)){
receiveNumMap
=
giftReceiveNumList
.
stream
().
collect
(
Collectors
.
toMap
(
a
->
a
.
getGiftPackageId
(),
a
->
a
.
getReceiveNum
(),
(
k1
,
k2
)
->
k2
));
}
for
(
GiftPackageDTO
giftPackageDTO
:
recordList
)
{
giftPackageDTO
.
setReceiveNum
(
0
);
if
(
MapUtils
.
isNotEmpty
(
receiveNumMap
)
&&
receiveNumMap
.
containsKey
(
giftPackageDTO
.
getId
())){
giftPackageDTO
.
setReceiveNum
(
receiveNumMap
.
get
(
giftPackageDTO
.
getId
()));
}
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@ParamLog
(
"新增专享礼包"
)
@ParamLog
(
"新增专享礼包"
)
@Override
@Override
...
@@ -93,5 +114,28 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
...
@@ -93,5 +114,28 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
}
}
}
}
@Override
public
PageBeanNew
<
MyGiftPackageDTO
>
list4MyGiftPackage
(
Long
wechatUserId
,
Integer
currentPage
,
Integer
numPerPage
)
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"wechatUserId"
,
wechatUserId
);
PageBeanNew
<
MyGiftPackageDTO
>
pageBeanNew
=
giftCouponPackageDao
.
listPageNew
(
new
PageParam
(
currentPage
,
numPerPage
),
paramMap
,
"list4MyGiftPackage"
);
if
(
pageBeanNew
==
null
||
ListUtils
.
isEmpty
(
pageBeanNew
.
getRecordList
()))
{
return
new
PageBeanNew
<>(
currentPage
,
numPerPage
,
new
ArrayList
<>());
}
return
pageBeanNew
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
useGiftCoupon
(
Long
wechatUserId
,
Long
giftPackageId
)
{
GiftReceive
giftReceive
=
giftReceiveDao
.
getGiftReceive
(
wechatUserId
,
giftPackageId
);
if
(
null
==
giftReceive
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"当前奖券包不存在"
);
}
if
(
giftReceive
.
getReceiveNum
()-
giftReceive
.
getUsedNum
()<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"当前奖券包已经使用完了"
);
}
//todo 可能有其他操作,如果点击不跳转页面,需要控制重复点击
giftReceiveDao
.
useGiftCoupon
(
wechatUserId
,
giftPackageId
);
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/check/GiftParamCheck.java
View file @
fc8825e0
...
@@ -20,9 +20,6 @@ public class GiftParamCheck {
...
@@ -20,9 +20,6 @@ public class GiftParamCheck {
if
(
null
==
giftCouponPackage
)
{
if
(
null
==
giftCouponPackage
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数为空"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"参数为空"
);
}
}
if
(
StringUtil
.
isEmpty
(
giftCouponPackage
.
getCoverPic
()))
{
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
,
"名称为空"
);
}
}
...
...
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/GiftReceiveDao.java
View file @
fc8825e0
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
;
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
;
import
com.pcloud.book.giftcoupon.dto.GiftReceiveDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.common.core.dao.BaseDao
;
import
com.pcloud.common.core.dao.BaseDao
;
...
@@ -22,32 +23,12 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> {
...
@@ -22,32 +23,12 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> {
*/
*/
GiftReceive
getGiftReceive
(
Long
wechatUserId
,
Long
giftPackageId
);
GiftReceive
getGiftReceive
(
Long
wechatUserId
,
Long
giftPackageId
);
/**
* 查询指定行数据
*
* @param offset 查询起始位置
* @param limit 查询条数
* @return 对象列表
*/
List
<
GiftReceive
>
queryAllByLimit
(
@Param
(
"offset"
)
int
offset
,
@Param
(
"limit"
)
int
limit
);
void
useGiftCoupon
(
Long
wechatUserId
,
Long
giftPackageId
);
/**
List
<
GiftReceiveDTO
>
getGiftReceiveNumList
(
List
<
Long
>
giftPackageIds
);
* 通过实体作为筛选条件查询
*
* @param giftReceive 实例对象
* @return 对象列表
*/
List
<
GiftReceive
>
queryAll
(
GiftReceive
giftReceive
);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int
deleteById
(
Integer
id
);
}
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dao/impl/GiftReceiveDaoImpl.java
View file @
fc8825e0
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
.
impl
;
package
com
.
pcloud
.
book
.
giftcoupon
.
dao
.
impl
;
import
com.pcloud.book.giftcoupon.dao.GiftReceiveDao
;
import
com.pcloud.book.giftcoupon.dao.GiftReceiveDao
;
import
com.pcloud.book.giftcoupon.dto.GiftReceiveDTO
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.book.giftcoupon.entity.GiftReceive
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
import
com.pcloud.common.core.dao.BaseDaoImpl
;
...
@@ -21,18 +22,20 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift
...
@@ -21,18 +22,20 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift
return
super
.
getSessionTemplate
().
selectOne
(
getStatement
(
"getGiftReceive"
),
map
);
return
super
.
getSessionTemplate
().
selectOne
(
getStatement
(
"getGiftReceive"
),
map
);
}
}
@Override
public
List
<
GiftReceive
>
queryAllByLimit
(
int
offset
,
int
limit
)
{
return
null
;
}
@Override
@Override
public
List
<
GiftReceive
>
queryAll
(
GiftReceive
giftReceive
)
{
public
void
useGiftCoupon
(
Long
wechatUserId
,
Long
giftPackageId
)
{
return
null
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"wechatUserId"
,
wechatUserId
);
map
.
put
(
"giftPackageId"
,
giftPackageId
);
super
.
getSessionTemplate
().
update
(
getStatement
(
"getGiftReceive"
),
map
);
}
}
@Override
@Override
public
int
deleteById
(
Integer
id
)
{
public
List
<
GiftReceiveDTO
>
getGiftReceiveNumList
(
List
<
Long
>
giftPackageIds
)
{
return
0
;
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"giftPackageIds"
,
giftPackageIds
);
return
super
.
getSessionTemplate
().
selectList
(
getStatement
(
"getGiftReceiveNumList"
),
map
);
}
}
}
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/GiftReceiveDTO.java
0 → 100644
View file @
fc8825e0
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
import
com.pcloud.common.entity.BaseEntity
;
import
lombok.Data
;
/**
* 专享礼券包领取表(GiftReceive)实体类
*
* @author makejava
* @since 2020-04-19 14:59:34
*/
@Data
public
class
GiftReceiveDTO
{
private
Long
giftPackageId
;
/**
* 领取数量
*/
private
Integer
receiveNum
;
}
\ No newline at end of file
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/dto/MyGiftPackageDTO.java
0 → 100644
View file @
fc8825e0
package
com
.
pcloud
.
book
.
giftcoupon
.
dto
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
java.util.Date
;
import
lombok.Data
;
@Data
public
class
MyGiftPackageDTO
{
/**
* 券id
*/
private
Long
id
;
/**
* 封面图
*/
private
String
coverPic
;
/**
* 名称
*/
private
String
title
;
/**
* 有效期开始时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
validDateBegin
;
/**
* 有效期结束时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
validDateEnd
;
/**
* 面额
*/
private
Integer
denomination
;
/**
* 未使用数量
*/
private
Integer
notUsedNum
;
}
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/facade/GiftCouponPackageFacade.java
View file @
fc8825e0
...
@@ -13,10 +13,12 @@ import com.pcloud.book.cultivate.entity.CultivateBookUser;
...
@@ -13,10 +13,12 @@ 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.GiftPackageDTO
;
import
com.pcloud.book.giftcoupon.dto.GiftPackageDTO
;
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.dto.ResponseDto
;
import
com.pcloud.common.dto.ResponseDto
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.exceptions.BizException
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.permission.PermissionException
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.NumberUtil
;
import
com.pcloud.common.utils.cookie.Cookie
;
import
com.pcloud.common.utils.cookie.Cookie
;
...
@@ -82,7 +84,7 @@ public class GiftCouponPackageFacade {
...
@@ -82,7 +84,7 @@ public class GiftCouponPackageFacade {
@ApiOperation
(
"礼券包列表"
)
@ApiOperation
(
"礼券包列表"
)
@GetMapping
(
"/list4GiftPackage"
)
@GetMapping
(
"/list4GiftPackage"
)
public
ResponseDto
<
?
>
list4GiftPackage
(
public
ResponseDto
<
PageBeanNew
<
GiftPackageDTO
>
>
list4GiftPackage
(
@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
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
...
@@ -103,4 +105,26 @@ public class GiftCouponPackageFacade {
...
@@ -103,4 +105,26 @@ public class GiftCouponPackageFacade {
return
new
ResponseDto
<>();
return
new
ResponseDto
<>();
}
}
@ApiOperation
(
"我的礼券包列表"
)
@GetMapping
(
"/list4MyGiftPackage"
)
public
ResponseDto
<
PageBeanNew
<
MyGiftPackageDTO
>>
list4MyGiftPackage
(
@CookieValue
(
value
=
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"currentPage"
,
required
=
false
)
Integer
currentPage
,
@RequestParam
(
value
=
"numPerPage"
,
required
=
false
)
Integer
numPerPage
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
return
new
ResponseDto
<>(
giftCouponPackageBiz
.
list4MyGiftPackage
(
wechatUserId
,
currentPage
,
numPerPage
));
}
@ApiOperation
(
"券包使用"
)
@PostMapping
(
"/useGiftCoupon"
)
public
ResponseDto
<?>
useGiftCoupon
(
@CookieValue
(
value
=
"userInfo"
)
String
userInfo
,
@RequestParam
(
value
=
"giftPackageId"
,
required
=
false
)
@ApiParam
(
"礼券id"
)
Long
giftPackageId
)
throws
BizException
,
PermissionException
{
Long
wechatUserId
=
Cookie
.
getId
(
userInfo
,
Cookie
.
_WECHAT_USER_ID
);
giftCouponPackageBiz
.
useGiftCoupon
(
wechatUserId
,
giftPackageId
);
return
new
ResponseDto
<>();
}
}
}
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftCouplePackageDao.xml
View file @
fc8825e0
...
@@ -125,13 +125,11 @@
...
@@ -125,13 +125,11 @@
a.denomination denomination,
a.denomination denomination,
a.receive_limit receiveLimit,
a.receive_limit receiveLimit,
a.stock,
a.stock,
ifnull(sum(b.receive_num),0) receiveNum,
a.valid_date_begin validDateBegin,
a.valid_date_begin validDateBegin,
a.valid_date_end validDateEnd,
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
if(NOW()
<![CDATA[ < ]]>
a.valid_date_begin,1,if(NOW() between a.valid_date_begin and a.valid_date_end,2,3)) state
from
from
gift_coupon_package a LEFT JOIN gift_receive b
gift_coupon_package a
on a.id=b.gift_package_id
where a.is_delete=0
where a.is_delete=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},'%')
...
...
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftReceiveDao.xml
View file @
fc8825e0
...
@@ -102,4 +102,39 @@
...
@@ -102,4 +102,39 @@
limit 1
limit 1
</select>
</select>
<select
id=
"useGiftCoupon"
parameterType=
"map"
>
update gift_receive
set used_num=used_num+1
where wechat_user_id=#{wechatUserId}
and gift_package_id=#{giftPackageId}
</select>
<select
id=
"list4MyGiftPackage"
parameterType=
"map"
resultType=
"com.pcloud.book.giftcoupon.dto.MyGiftPackageDTO"
>
select
a.title title,
a.cover_pic coverPic,
a.denomination denomination,
a.valid_date_begin validDateBegin,
a.valid_date_end validDateEnd,
a.id id,
(b.receive_num-ifnull(b.used_num,0)) noUsedNum
from
gift_receive b LEFT JOIN gift_coupon_package a
on a.id=b.gift_package_id
where b.wechat_user_id=#{wechatUserId}
and b.used_num
<![CDATA[ < ]]>
b.receive_num
order by b.update_time desc
</select>
<select
id=
"getGiftReceiveNumList"
parameterType=
"map"
resultType=
"com.pcloud.book.giftcoupon.dto.GiftReceiveDTO"
>
select gift_package_id giftPackageId,
ifnull(sum(receive_num),0) receiveNum
from gift_receive
where gift_package_id in
<foreach
collection=
"giftPackageIds"
open=
"("
close=
")"
item=
"item"
separator=
","
>
#{item}
</foreach>
group by gift_package_id
</select>
</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