Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gxpt_ht
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
pseer
gxpt_ht
Commits
02cb26ea
Commit
02cb26ea
authored
Nov 16, 2023
by
吕明尚
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加劵码只能一个人使用的限制
parent
725c41cd
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
3 deletions
+13
-3
QPController.java
...c/main/java/share/web/controller/system/QPController.java
+8
-1
SConsumerCouponController.java
...hare/web/controller/system/SConsumerCouponController.java
+1
-1
QPServiceImpl.java
...rc/main/java/share/system/service/impl/QPServiceImpl.java
+4
-1
No files found.
share-front/src/main/java/share/web/controller/system/QPController.java
View file @
02cb26ea
...
...
@@ -3,6 +3,8 @@ package share.web.controller.system;
import
com.dianping.openapi.sdk.api.tuangou.entity.*
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -46,7 +48,12 @@ public class QPController {
//用户验券接口
@GetMapping
(
"/consumeByUser"
)
public
R
<
TuangouReceiptPrepareResponseEntityVo
>
consumeByUser
(
String
code
,
String
openShopUuid
)
{
return
R
.
ok
(
qpService
.
consumeByUser
(
code
,
openShopUuid
));
TuangouReceiptPrepareResponseEntityVo
tuangouReceiptPrepareResponseEntityVo
=
qpService
.
consumeByUser
(
code
,
openShopUuid
);
if
(
ObjectUtils
.
isEmpty
(
tuangouReceiptPrepareResponseEntityVo
))
{
return
R
.
fail
(
tuangouReceiptPrepareResponseEntityVo
,
"该券码已被使用"
);
}
else
{
return
R
.
ok
(
tuangouReceiptPrepareResponseEntityVo
);
}
}
//用户销券接口
...
...
share-front/src/main/java/share/web/controller/system/SConsumerCouponController.java
View file @
02cb26ea
...
...
@@ -65,7 +65,7 @@ public class SConsumerCouponController extends BaseController {
public
R
<
List
<
SConsumerCoupon
>>
query
(
@RequestBody
@Validated
CouponRequest
couponRequest
)
{
List
<
SConsumerCoupon
>
sConsumerCoupons
=
sConsumerCouponService
.
availableCouponList
(
couponRequest
);
if
(
CollectionUtils
.
isEmpty
(
sConsumerCoupons
))
{
return
R
.
ok
(
sConsumerCoupons
,
"暂无可用优惠券"
);
return
R
.
fail
(
sConsumerCoupons
,
"暂无可用优惠券"
);
}
else
{
return
R
.
ok
(
sConsumerCoupons
);
}
...
...
share-system/src/main/java/share/system/service/impl/QPServiceImpl.java
View file @
02cb26ea
...
...
@@ -72,11 +72,12 @@ public class QPServiceImpl implements QPService {
LambdaQueryWrapper
<
SConsumerCoupon
>
queryWrapper
=
new
LambdaQueryWrapper
<>();
queryWrapper
.
eq
(
SConsumerCoupon:
:
getDealId
,
prepare
.
getDeal_id
());
queryWrapper
.
eq
(
SConsumerCoupon:
:
getCouponCode
,
code
);
queryWrapper
.
eq
(
SConsumerCoupon:
:
getUseStatus
,
UserStatusEnum
.
UNUSED
.
getCode
());
SConsumerCoupon
two
=
isConsumerCouponService
.
getOne
(
queryWrapper
);
if
(
ObjectUtils
.
isNotEmpty
(
two
))
{
//判断是否本人领取过
if
(!
two
.
getConsumerId
().
equals
(
user
.
getId
()))
{
throw
new
RuntimeException
(
"该券码已被领取"
)
;
return
null
;
}
else
{
//领取删除原来的
isConsumerCouponService
.
deleteSConsumerCouponById
(
two
.
getId
());
...
...
@@ -123,6 +124,7 @@ public class QPServiceImpl implements QPService {
});
sConsumerCoupon
.
setCouponTimeStart
(
"00:00"
);
sConsumerCoupon
.
setCouponTimeEnd
(
"24:00"
);
sConsumerCoupon
.
setUseStatus
(
UserStatusEnum
.
UNUSED
.
getCode
());
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
sConsumerCoupon
.
setCreateTime
(
new
Date
());
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
...
...
@@ -148,6 +150,7 @@ public class QPServiceImpl implements QPService {
sConsumerCoupon
.
setEndDate
(
prepare
.
getReceiptEndDate
());
sConsumerCoupon
.
setCouponTimeStart
(
sCoupon
.
getValidStartTime
());
sConsumerCoupon
.
setCouponTimeEnd
(
sCoupon
.
getValidEndTime
());
sConsumerCoupon
.
setUseStatus
(
UserStatusEnum
.
UNUSED
.
getCode
());
sConsumerCoupon
.
setCreateBy
(
String
.
valueOf
(
user
.
getId
()));
sConsumerCoupon
.
setCreateTime
(
new
Date
());
isConsumerCouponService
.
insertSConsumerCoupon
(
sConsumerCoupon
);
...
...
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