Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
caosy
/
fun-golf-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
923612a0
authored
Sep 28, 2018
by
chongli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分享或者使用券再赠券功能
parent
4ea4d164
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
0 deletions
src/main/java/com/ctrip/fun/golf/service/basic/VoucherService.java
src/main/java/com/ctrip/fun/golf/service/order/AbstractOrderService.java
src/main/java/com/ctrip/fun/golf/service/payment/AbstractNotifyService.java
src/main/java/com/ctrip/fun/golf/service/basic/VoucherService.java
View file @
923612a0
...
...
@@ -867,12 +867,40 @@ public class VoucherService {
voucherGetLog
.
setCreateTime
(
new
Date
());
voucherGetLog
.
setNewVoucherid
(
newVoucher
.
getId
());
voucherGetLogDao
.
save
(
voucherGetLog
);
//执行分享掉再送券活动
this
.
voucherUsedSend
(
voucher
.
getId
(),
voucherShareLog
.
getUid
(),
voucherShareLog
.
getId
()+
""
,
VoucherSourceEnum
.
RULE_VOUCHERUSED_PRESENT
.
getValue
());
//设置状态
response
.
setStatus
(
1
);
response
.
setMessage
(
"抢券成功"
);
response
.
setBody
(
"success"
);
return
response
;
}
/**
* //执行用户券下单或者分享使用掉了券,再补发送券活动
* @param voucher 使用的券对象
* @param uid 券送给谁
* @param remark 本次发券备注:分享id,或者订单号
* @param source 券来源
*/
public
void
voucherUsedSend
(
int
usedVoucherId
,
String
uid
,
String
remark
,
int
source
){
Voucher
voucher
=
voucherDao
.
findById
(
usedVoucherId
);
ClientConfig
clientConfig
=
clientConfigDao
.
getByType
(
"voucher_used_send"
);
JSONObject
jsobj
=
JSONObject
.
parseObject
(
clientConfig
.
getMessage
());
if
(
jsobj
.
get
(
voucher
.
getRuleId
()+
""
)!=
null
){
String
[]
newRuleIds
=
jsobj
.
get
(
voucher
.
getRuleId
()+
""
).
toString
().
split
(
","
);
for
(
String
newRuleId:
newRuleIds
){
VoucherRule
roucherRule
=
voucherRuleDao
.
findById
(
Integer
.
parseInt
(
newRuleId
));
for
(
int
i
=
0
;
i
<
roucherRule
.
getQuantity
();
i
++){
Voucher
againVoucher
=
this
.
getVoucherFromRule
(
roucherRule
);
againVoucher
.
setNo
(
""
);
againVoucher
.
setUid
(
uid
);
againVoucher
.
setSourceRemark
(
remark
);
againVoucher
.
setSource
(
source
);
voucherDao
.
save
(
againVoucher
);
}
}
}
}
public
Response
<
VoucherItemDTO
>
executeGetRedeemCodeForMallOrder
(
VoucherQueryDto
query
)
{
Response
<
VoucherItemDTO
>
response
=
new
Response
<
VoucherItemDTO
>();
...
...
src/main/java/com/ctrip/fun/golf/service/order/AbstractOrderService.java
View file @
923612a0
...
...
@@ -28,6 +28,7 @@ import com.ctrip.fun.common.vo.ResponseStatusEnum;
import
com.ctrip.fun.common.vo.basic.AbstractRuleConditionBean
;
import
com.ctrip.fun.common.vo.basic.MultipleCourseConditionBean
;
import
com.ctrip.fun.common.vo.basic.VipGradeEnum
;
import
com.ctrip.fun.common.vo.basic.VoucherSourceEnum
;
import
com.ctrip.fun.common.vo.order.AbstractOrderBean
;
import
com.ctrip.fun.common.vo.order.AbstractOrderListItemBean
;
import
com.ctrip.fun.common.vo.order.CustomerInfoBean
;
...
...
@@ -1104,6 +1105,9 @@ public abstract class AbstractOrderService<H extends AbstractOrderBean<T>, T> ex
if
(
usedCount
!=
order
.
getVoucherCount
()){
throw
new
OrderException
(-
100
,
"您的抵用劵使用错误"
);
}
for
(
VoucherItemBean
bean:
beanlist
){
this
.
voucherService
.
voucherUsedSend
(
bean
.
getId
(),
order
.
getUid
(),
order
.
getOrderNo
()+
""
,
VoucherSourceEnum
.
RULE_VOUCHERUSED_PRESENT
.
getValue
());
}
}
}
if
(
order
.
getPrePayCardAmount
().
doubleValue
()
>
0
)
{
...
...
src/main/java/com/ctrip/fun/golf/service/payment/AbstractNotifyService.java
View file @
923612a0
...
...
@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
import
com.alibaba.fastjson.JSONObject
;
import
com.ctrip.fun.common.core.exceptions.service.ServiceException
;
import
com.ctrip.fun.common.core.util.RSA
;
import
com.ctrip.fun.common.vo.basic.VoucherSourceEnum
;
import
com.ctrip.fun.common.vo.integral.IntegralLogTypeEnum
;
import
com.ctrip.fun.common.vo.order.OrderCategoryEnum
;
import
com.ctrip.fun.common.vo.order.OrderProcessEnum
;
...
...
@@ -277,6 +278,12 @@ public abstract class AbstractNotifyService extends CorePaymentService {
try
{
this
.
voucherService
.
userVoucher
(
order
.
getVoucherCount
(),
order
.
getOrderNo
(),
order
.
getVoucherIDList
());
if
(
order
.
getVoucherIDList
()!=
null
&&!
""
.
equals
(
order
.
getVoucherIDList
())){
for
(
String
usedVoucherId:
order
.
getVoucherIDList
().
split
(
","
)){
this
.
voucherService
.
voucherUsedSend
(
Integer
.
parseInt
(
usedVoucherId
),
order
.
getUid
(),
order
.
getOrderNo
()+
""
,
VoucherSourceEnum
.
RULE_VOUCHERUSED_PRESENT
.
getValue
());
}
}
}
catch
(
Exception
e
)
{
logger
.
warn
(
e
.
getMessage
(),
e
);
handPayException
(
order
,
e
);
...
...
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