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
e8022eaf
Commit
e8022eaf
authored
Apr 29, 2020
by
郑勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改课程券使用不消失
parent
7bb7becf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
GiftCouponPackageBizImpl.java
...ud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
+10
-3
GiftReceiveDao.xml
...k/src/main/resources/mapper/giftConpon/GiftReceiveDao.xml
+1
-1
No files found.
pcloud-service-book/src/main/java/com/pcloud/book/giftcoupon/biz/impl/GiftCouponPackageBizImpl.java
View file @
e8022eaf
...
...
@@ -13,6 +13,7 @@ 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.GiftReceive
;
import
com.pcloud.book.giftcoupon.enums.CouponTypeEnum
;
import
com.pcloud.common.core.aspect.ParamLog
;
import
com.pcloud.common.page.PageBeanNew
;
import
com.pcloud.common.page.PageParam
;
...
...
@@ -147,12 +148,18 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
useGiftCoupon
(
Long
wechatUserId
,
Long
giftPackageId
)
{
GiftCouponPackage
giftCouponPackage
=
giftCouponPackageDao
.
getById
(
giftPackageId
);
if
(
null
==
giftCouponPackage
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"当前奖券包不存在"
);
}
GiftReceive
giftReceive
=
giftReceiveDao
.
getGiftReceive
(
wechatUserId
,
giftPackageId
);
if
(
null
==
giftReceive
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
当前奖券包不存在
"
);
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"
你还未领取该奖券包
"
);
}
if
(
giftReceive
.
getReceiveNum
()-
giftReceive
.
getUsedNum
()<=
0
){
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"当前奖券包已经使用完了"
);
if
(!
CouponTypeEnum
.
COURSE_COUPON
.
value
.
equals
(
giftCouponPackage
.
getCouponType
()))
{
if
(
giftReceive
.
getReceiveNum
()
-
giftReceive
.
getUsedNum
()
<=
0
)
{
throw
new
BookBizException
(
BookBizException
.
PARAM_IS_NULL
,
"当前奖券包已经使用完了"
);
}
}
//todo 可能有其他操作,如果点击不跳转页面,需要控制重复点击
giftReceiveDao
.
useGiftCoupon
(
wechatUserId
,
giftPackageId
);
...
...
pcloud-service-book/src/main/resources/mapper/giftConpon/GiftReceiveDao.xml
View file @
e8022eaf
...
...
@@ -138,7 +138,7 @@
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
and
( (coupon_type=1) or (coupon_type!=1 and b.used_num
<![CDATA[ < ]]>
b.receive_num) )
<if
test=
"state!=null and state==1"
>
and now()
<![CDATA[ <= ]]>
a.valid_date_end
</if>
...
...
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