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
8e1e1242
Commit
8e1e1242
authored
Jul 18, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改使用优惠卷
parent
b736781e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
36 additions
and
9 deletions
+36
-9
ActivityFeign.java
.../java/com/xxfc/platform/activity/feign/ActivityFeign.java
+5
-2
UserCouponBiz.java
...in/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
+24
-3
UserCouponController.java
...com/xxfc/platform/activity/rest/UserCouponController.java
+7
-4
No files found.
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/feign/ActivityFeign.java
View file @
8e1e1242
...
...
@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiOperation;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
/**
...
...
@@ -27,10 +28,12 @@ public interface ActivityFeign {
@ApiOperation
(
"优惠卷使用"
)
@RequestMapping
(
value
=
"/user/use"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
use
(
public
BigDecimal
use
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
,
@RequestParam
(
value
=
"TickerNo"
)
String
TickerNo
,
@RequestParam
(
value
=
"orderNo"
)
String
orderNo
);
@RequestParam
(
value
=
"orderNo"
)
String
orderNo
,
@RequestParam
(
value
=
"channel"
)
Integer
channel
,
@RequestParam
(
value
=
"orderNo"
)
BigDecimal
amout
);
@ApiOperation
(
"优惠卷取消使用"
)
@RequestMapping
(
value
=
"/user/cancelUse"
,
method
=
RequestMethod
.
POST
)
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
View file @
8e1e1242
...
...
@@ -17,6 +17,7 @@ import com.xxfc.platform.activity.mapper.UserCouponMapper;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
tk.mybatis.mapper.entity.Example
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
...
...
@@ -127,23 +128,43 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
}
//支付后更新优惠卷状态
public
void
useTickerNo
(
Integer
userId
,
String
TickerNo
,
String
orderNo
){
public
BigDecimal
useTickerNo
(
Integer
userId
,
String
TickerNo
,
String
orderNo
,
Integer
channel
,
BigDecimal
amout
){
BigDecimal
couponAmout
=
new
BigDecimal
(
"0.00"
);
if
(
userId
==
null
||
userId
==
0
||
StringUtils
.
isBlank
(
TickerNo
)){
log
.
error
(
"----参数不能为空"
);
return
;
return
couponAmout
;
}
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"TickerNo"
,
TickerNo
).
andEqualTo
(
"isDel"
,
0
);
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()==
0
){
log
.
error
(
userId
+
"----已领优惠卷"
);
return
;
return
couponAmout
;
}
UserCoupon
userCoupon
=
list
.
get
(
0
);
userCoupon
.
setIsUse
(
1
);
userCoupon
.
setOrderNo
(
orderNo
);
userCoupon
.
setUseTime
(
System
.
currentTimeMillis
());
updateSelectiveById
(
userCoupon
);
return
getCouponAmout
(
userCoupon
.
getCouponId
(),
channel
,
amout
);
}
public
BigDecimal
getCouponAmout
(
Integer
couponId
,
Integer
channel
,
BigDecimal
amout
)
{
BigDecimal
couponAmout
=
new
BigDecimal
(
"0.00"
);
Coupon
coupon
=
couponBiz
.
selectById
(
couponId
);
if
(
coupon
!=
null
&&
coupon
.
getChannel
()
==
channel
)
{
Integer
type
=
coupon
.
getType
();
if
(
type
!=
null
)
{
BigDecimal
useAmout
=
coupon
.
getUsedAmount
();
if
(
amout
.
compareTo
(
useAmout
)
>
0
)
{
if
(
type
==
3
||
(
type
==
1
&&
(
amout
.
compareTo
(
coupon
.
getWithAmount
())
>=
0
)))
{
couponAmout
=
amout
.
subtract
(
useAmout
);
}
}
}
}
return
couponAmout
;
}
//取消使用优惠卷
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/UserCouponController.java
View file @
8e1e1242
...
...
@@ -10,6 +10,8 @@ import io.swagger.annotations.ApiOperation;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
@RestController
@RequestMapping
(
"user"
)
public
class
UserCouponController
extends
ActivityBaseController
<
UserCouponBiz
>
{
...
...
@@ -45,13 +47,14 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
@ApiOperation
(
"优惠卷使用"
)
@RequestMapping
(
value
=
"/use"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
use
(
public
BigDecimal
use
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"TickerNo"
,
defaultValue
=
""
)
String
TickerNo
,
@RequestParam
(
value
=
"orderNo"
,
defaultValue
=
""
)
String
orderNo
@RequestParam
(
value
=
"orderNo"
,
defaultValue
=
""
)
String
orderNo
,
@RequestParam
(
value
=
"channel"
,
defaultValue
=
"1"
)
Integer
channel
,
@RequestParam
(
value
=
"orderNo"
,
defaultValue
=
"0.00"
)
BigDecimal
amout
)
{
baseBiz
.
useTickerNo
(
userId
,
TickerNo
,
orderNo
);
return
ObjectRestResponse
.
succ
();
return
baseBiz
.
useTickerNo
(
userId
,
TickerNo
,
orderNo
,
channel
,
amout
);
}
@ApiOperation
(
"优惠卷取消使用"
)
...
...
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