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
f7bd0a98
Commit
f7bd0a98
authored
Jul 22, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
637cbf69
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
28 deletions
+32
-28
ActivityFeign.java
.../java/com/xxfc/platform/activity/feign/ActivityFeign.java
+2
-1
UserCouponBiz.java
...in/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
+19
-19
UserCouponController.java
...com/xxfc/platform/activity/rest/UserCouponController.java
+3
-2
OrderRentVehicleService.java
.../xxfc/platform/order/service/OrderRentVehicleService.java
+4
-3
OrderTourService.java
...ava/com/xxfc/platform/order/service/OrderTourService.java
+4
-3
No files found.
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/feign/ActivityFeign.java
View file @
f7bd0a98
...
...
@@ -7,6 +7,7 @@ import org.springframework.cloud.openfeign.FeignClient;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
...
...
@@ -34,7 +35,7 @@ public interface ActivityFeign {
@RequestMapping
(
value
=
"/user/use"
,
method
=
RequestMethod
.
POST
)
public
BigDecimal
use
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
,
@RequestParam
(
value
=
"tickerNo
"
)
String
tickerNo
,
@RequestParam
(
value
=
"tickerNo
s"
)
List
<
String
>
tickerNos
,
@RequestParam
(
value
=
"orderNo"
)
String
orderNo
,
@RequestParam
(
value
=
"channel"
)
Integer
channel
,
@RequestParam
(
value
=
"amount"
)
BigDecimal
amount
,
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
View file @
f7bd0a98
...
...
@@ -11,6 +11,7 @@ import com.xxfc.platform.activity.vo.UserCouponVo;
import
com.xxfc.platform.universal.weixin.util.Snowflake
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.assertj.core.util.Arrays
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.activity.mapper.UserCouponMapper
;
...
...
@@ -147,38 +148,37 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return
mapper
.
getUserCoupon
(
tickerNo
);
}
//支付后更新优惠卷状态
public
BigDecimal
useTickerNo
(
Integer
userId
,
String
TickerNo
,
String
orderNo
,
Integer
channel
,
BigDecimal
amout
,
Integer
type
){
//支付后更新优惠卷状态
:type.1-
public
BigDecimal
useTickerNo
(
Integer
userId
,
List
<
String
>
tickerNos
,
String
orderNo
,
Integer
channel
,
BigDecimal
amout
,
Integer
type
){
BigDecimal
couponAmout
=
new
BigDecimal
(
"0.00"
);
if
(
couponAmout
.
compareTo
(
amout
)
>=
0
)
{
return
BigDecimal
.
ZERO
;
}
if
(
userId
==
null
||
userId
==
0
||
StringUtils
.
isBlank
(
TickerNo
)
){
if
(
userId
==
null
||
userId
==
0
||
tickerNos
==
null
||
tickerNos
.
size
()==
0
){
log
.
error
(
"----参数不能为空"
);
return
couponAmout
;
}
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
and
EqualTo
(
"tickerNo"
,
TickerNo
).
andEqualTo
(
"isDel"
,
0
);
example
.
createCriteria
().
and
In
(
"tickerNo"
,
tickerNos
).
andEqualTo
(
"isDel"
,
0
);
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()==
0
){
log
.
error
(
userId
+
"----没有可用优惠卷--
tickerNo==="
+
TickerNo
);
log
.
error
(
userId
+
"----没有可用优惠卷--
"
);
return
couponAmout
;
}
UserCoupon
userCoupon
=
list
.
get
(
0
);
if
(
userCoupon
!=
null
&&
userCoupon
.
getIsUse
()==
1
){
log
.
error
(
userId
+
"----该优惠卷已使用--tickerNo=="
+
TickerNo
);
return
couponAmout
;
}
if
(
type
==
1
){
userCoupon
.
setIsUse
(
1
);
userCoupon
.
setOrderNo
(
orderNo
);
userCoupon
.
setUseTime
(
System
.
currentTimeMillis
());
updateSelectiveById
(
userCoupon
);
for
(
UserCoupon
userCoupon:
list
)
{
if
(
userCoupon
!=
null
&&
userCoupon
.
getIsUse
()==
1
){
log
.
error
(
userId
+
"----该优惠卷已使用--tickerNo=="
);
continue
;
}
if
(
type
==
1
){
userCoupon
.
setIsUse
(
1
);
userCoupon
.
setOrderNo
(
orderNo
);
userCoupon
.
setUseTime
(
System
.
currentTimeMillis
());
updateSelectiveById
(
userCoupon
);
}
couponAmout
=
couponAmout
.
add
(
getCouponAmout
(
userCoupon
.
getCouponId
(),
channel
,
amout
));
}
return
getCouponAmout
(
userCoupon
.
getCouponId
(),
channel
,
amout
);
return
couponAmout
;
}
public
BigDecimal
getCouponAmout
(
Integer
couponId
,
Integer
channel
,
BigDecimal
amout
)
{
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/UserCouponController.java
View file @
f7bd0a98
...
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.util.List
;
@RestController
@RequestMapping
(
"user"
)
...
...
@@ -57,13 +58,13 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
@RequestMapping
(
value
=
"/use"
,
method
=
RequestMethod
.
POST
)
public
BigDecimal
use
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"tickerNo
"
,
defaultValue
=
""
)
String
tickerNo
,
@RequestParam
(
value
=
"tickerNo
s"
,
defaultValue
=
""
)
List
<
String
>
tickerNos
,
@RequestParam
(
value
=
"orderNo"
,
defaultValue
=
""
)
String
orderNo
,
@RequestParam
(
value
=
"channel"
,
defaultValue
=
"1"
)
Integer
channel
,
@RequestParam
(
value
=
"amount"
,
defaultValue
=
"0.00"
)
BigDecimal
amount
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
)
{
return
baseBiz
.
useTickerNo
(
userId
,
tickerNo
,
orderNo
,
channel
,
amount
,
type
);
return
baseBiz
.
useTickerNo
(
userId
,
tickerNo
s
,
orderNo
,
channel
,
amount
,
type
);
}
@ApiOperation
(
"优惠卷取消使用"
)
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderRentVehicleService.java
View file @
f7bd0a98
...
...
@@ -39,6 +39,7 @@ import java.math.BigDecimal;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
static
com
.
github
.
wxiaoqi
.
security
.
admin
.
constant
.
enumerate
.
MemberEnum
.*;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
...
...
@@ -141,7 +142,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//如果有使用优惠券,则扣减
if
(
BigDecimal
.
ZERO
.
compareTo
(
bo
.
getOrder
().
getCouponAmount
())
<
0
)
{
activityFeign
.
use
(
bo
.
getAppUserDTO
().
getUserid
(),
bo
.
getTickerNo
()
.
get
(
0
)
,
bo
.
getOrder
().
getNo
(),
channel
,
bo
.
getOrder
().
getGoodsAmount
(),
ActivityFeign
.
TYPE_USE
);
activityFeign
.
use
(
bo
.
getAppUserDTO
().
getUserid
(),
bo
.
getTickerNo
(),
bo
.
getOrder
().
getNo
(),
channel
,
bo
.
getOrder
().
getGoodsAmount
(),
ActivityFeign
.
TYPE_USE
);
}
//获取可用车辆
...
...
@@ -245,9 +246,9 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//优惠券处理
//待完成
if
(
null
!=
detail
.
getTickerNo
()
&&
detail
.
getTickerNo
().
size
()
>
0
)
{
couponAmount
=
activityFeign
.
use
(
dto
.
getUserid
(),
detail
.
getTickerNo
()
.
get
(
0
)
,
detail
.
getOrder
().
getNo
(),
channel
,
goodsAmount
,
ActivityFeign
.
TYPE_NO_USE
);
couponAmount
=
activityFeign
.
use
(
dto
.
getUserid
(),
detail
.
getTickerNo
(),
detail
.
getOrder
().
getNo
(),
channel
,
goodsAmount
,
ActivityFeign
.
TYPE_NO_USE
);
if
(
couponAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
detail
.
getOrder
().
setCouponTickerNos
(
detail
.
getTickerNo
().
get
(
0
));
detail
.
getOrder
().
setCouponTickerNos
(
detail
.
getTickerNo
().
stream
().
collect
(
Collectors
.
joining
(
","
)
));
}
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderTourService.java
View file @
f7bd0a98
...
...
@@ -140,7 +140,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//如果有使用优惠券,则扣减
if
(
BigDecimal
.
ZERO
.
compareTo
(
bo
.
getOrder
().
getCouponAmount
())
<
0
)
{
activityFeign
.
use
(
bo
.
getAppUserDTO
().
getUserid
(),
bo
.
getTickerNo
()
.
get
(
0
)
,
bo
.
getOrder
().
getNo
(),
channel
,
bo
.
getOrder
().
getGoodsAmount
(),
ActivityFeign
.
TYPE_USE
);
activityFeign
.
use
(
bo
.
getAppUserDTO
().
getUserid
(),
bo
.
getTickerNo
(),
bo
.
getOrder
().
getNo
(),
channel
,
bo
.
getOrder
().
getGoodsAmount
(),
ActivityFeign
.
TYPE_USE
);
}
super
.
handleDetail
(
bo
);
...
...
@@ -217,9 +217,10 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//优惠券处理
//待完成
if
(
null
!=
detail
.
getTickerNo
()
&&
detail
.
getTickerNo
().
size
()
>
0
)
{
couponAmount
=
activityFeign
.
use
(
dto
.
getUserid
(),
detail
.
getTickerNo
()
.
get
(
0
)
,
detail
.
getOrder
().
getNo
(),
channel
,
goodsAmount
,
ActivityFeign
.
TYPE_NO_USE
);
couponAmount
=
activityFeign
.
use
(
dto
.
getUserid
(),
detail
.
getTickerNo
(),
detail
.
getOrder
().
getNo
(),
channel
,
goodsAmount
,
ActivityFeign
.
TYPE_NO_USE
);
if
(
couponAmount
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
detail
.
getOrder
().
setCouponTickerNos
(
detail
.
getTickerNo
().
get
(
0
));
detail
.
getOrder
().
setCouponTickerNos
(
detail
.
getTickerNo
()
.
stream
().
collect
(
Collectors
.
joining
(
","
)));
}
}
...
...
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