Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
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
youjj
cloud-platform
Commits
05963319
Commit
05963319
authored
Aug 23, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
3e5dffe1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
+44
-2
UserCouponBiz.java
...in/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
+44
-2
No files found.
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
View file @
05963319
...
@@ -91,6 +91,26 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
...
@@ -91,6 +91,26 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
log
.
error
(
userId
+
"----已领优惠卷"
);
log
.
error
(
userId
+
"----已领优惠卷"
);
return
null
;
return
null
;
}
}
falg
=
checkLed
(
userId
,
couponId
,
coupon
.
getLimitCollar
(),
coupon
.
getQuota
());
if
(
falg
){
log
.
error
(
userId
+
"----已超过领取限制"
);
return
null
;
}
return
led
(
coupon
,
userId
);
}
//后台领劵(一个劵可以发多张)
public
String
adminUserLedCoupon
(
Integer
userId
,
Integer
couponId
){
Coupon
coupon
=
couponBiz
.
selectById
(
couponId
);
if
(
coupon
==
null
||
coupon
.
getIsDel
()!=
0
||
coupon
.
getStatus
()!=
1
){
log
.
error
(
userId
+
"----无可领取优惠卷"
);
return
null
;
}
boolean
falg
=
checkLed
(
userId
,
couponId
,
coupon
.
getLimitCollar
(),
coupon
.
getQuota
());
if
(
falg
){
log
.
error
(
userId
+
"----已超过领取限制"
);
return
null
;
}
return
led
(
coupon
,
userId
);
return
led
(
coupon
,
userId
);
}
}
...
@@ -123,7 +143,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
...
@@ -123,7 +143,7 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
//检查用户是否领卷
//检查用户是否领卷
public
boolean
checkUserLed
(
Integer
userId
,
Integer
id
){
public
boolean
checkUserLed
(
Integer
userId
,
Integer
id
){
Example
example
=
new
Example
(
UserCoupon
.
class
);
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"userId"
,
userId
).
andEqualTo
(
"couponId"
,
id
);
example
.
createCriteria
().
andEqualTo
(
"userId"
,
userId
).
andEqualTo
(
"couponId"
,
id
)
.
andEqualTo
(
"isDel"
,
0
)
;
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()>
0
){
if
(
list
.
size
()>
0
){
log
.
error
(
userId
+
"----已领优惠卷"
);
log
.
error
(
userId
+
"----已领优惠卷"
);
...
@@ -132,6 +152,29 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
...
@@ -132,6 +152,29 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return
false
;
return
false
;
}
}
//检查用户是否可领卷
public
boolean
checkLed
(
Integer
userId
,
Integer
id
,
Integer
limitCollar
,
Integer
quota
){
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"userId"
,
userId
).
andEqualTo
(
"couponId"
,
id
).
andEqualTo
(
"isDel"
,
0
);
Integer
num
=
selectCountByExample
(
example
);
if
(
num
==
null
||
num
==
0
){
log
.
error
(
userId
+
"----无领此优惠卷----couponid==="
+
id
);
return
false
;
}
if
(
limitCollar
==
null
||
num
>=
limitCollar
){
log
.
error
(
userId
+
"----此优惠卷超过每人限领次数----couponid==="
+
id
+
"----limitCollar==="
+
limitCollar
);
return
true
;
}
example
.
clear
();
example
.
createCriteria
().
andEqualTo
(
"couponId"
,
id
).
andEqualTo
(
"isDel"
,
0
);
num
=
selectCountByExample
(
example
);
if
(
quota
==
null
||
quota
==
0
||(
num
!=
null
&&
num
>
0
&&
num
>=
quota
)){
log
.
error
(
userId
+
"----此优惠卷超过发券数量----couponid==="
+
id
+
"----quota==="
+
quota
);
return
true
;
}
return
false
;
}
//获取我的优惠卷
//获取我的优惠卷
public
ObjectRestResponse
getCouponList
(
Integer
userId
,
int
type
,
Integer
channel
,
BigDecimal
amout
){
public
ObjectRestResponse
getCouponList
(
Integer
userId
,
int
type
,
Integer
channel
,
BigDecimal
amout
){
if
(
userId
==
null
||
userId
==
0
){
if
(
userId
==
null
||
userId
==
0
){
...
@@ -206,7 +249,6 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
...
@@ -206,7 +249,6 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
result
.
put
(
"array"
,
array
);
result
.
put
(
"array"
,
array
);
return
ObjectRestResponse
.
succ
(
result
);
return
ObjectRestResponse
.
succ
(
result
);
}
}
//获取我的优惠卷
//获取我的优惠卷
public
ObjectRestResponse
getUserCouponList
(
Integer
userId
,
int
type
,
Integer
channel
,
BigDecimal
amout
)
{
public
ObjectRestResponse
getUserCouponList
(
Integer
userId
,
int
type
,
Integer
channel
,
BigDecimal
amout
)
{
if
(
userId
==
null
||
userId
==
0
)
{
if
(
userId
==
null
||
userId
==
0
)
{
...
...
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