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
fce9f53f
authored
Jun 11, 2018
by
chongli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
980首次充值,余额付款,走支付接口的付款都发放优惠券
parent
d885d279
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
46 additions
and
57 deletions
src/main/java/com/ctrip/fun/golf/service/order/AbstractOrderService.java
src/main/java/com/ctrip/fun/golf/service/order/CommuneOrderService.java
src/main/java/com/ctrip/fun/golf/service/payment/AbstractNotifyService.java
src/main/java/com/ctrip/fun/golf/service/payment/CommuneNotifyService.java
src/main/resources/order.spring.xml
src/main/resources/payment.spring.xml
src/main/java/com/ctrip/fun/golf/service/order/AbstractOrderService.java
View file @
fce9f53f
...
...
@@ -430,6 +430,10 @@ public abstract class AbstractOrderService<H extends AbstractOrderBean<T>, T> ex
return
null
;
}
//执行一营销活动的代码
protected
void
executeOrderActive
(
Order
order
){
};
/**
* 判断订单是否可删除
...
...
src/main/java/com/ctrip/fun/golf/service/order/CommuneOrderService.java
View file @
fce9f53f
...
...
@@ -4,13 +4,16 @@
package
com
.
ctrip
.
fun
.
golf
.
service
.
order
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.util.CollectionUtils
;
import
com.ctrip.fun.common.core.util.DateUtil
;
import
com.ctrip.fun.common.core.util.StringUtils
;
import
com.ctrip.fun.common.vo.PagedResponseBean
;
import
com.ctrip.fun.common.vo.Response
;
...
...
@@ -28,8 +31,11 @@ import com.ctrip.fun.common.vo.order.OrderStatusEnum;
import
com.ctrip.fun.common.vo.order.PlaceOrderResponseBean
;
import
com.ctrip.fun.common.vo.order.UserCommuneOrderStatusEnum
;
import
com.ctrip.fun.common.vo.product.ProductPaymentTypeEnum
;
import
com.ctrip.fun.golf.dao.client.ClientConfigDao
;
import
com.ctrip.fun.golf.dao.order.CommuneOrderItemDao
;
import
com.ctrip.fun.golf.domain.basic.Voucher
;
import
com.ctrip.fun.golf.domain.basic.VoucherRule
;
import
com.ctrip.fun.golf.domain.client.ClientConfig
;
import
com.ctrip.fun.golf.domain.order.CommuneOrderItem
;
import
com.ctrip.fun.golf.domain.order.Order
;
import
com.ctrip.fun.golf.domain.user.UserExt
;
...
...
@@ -48,6 +54,7 @@ public class CommuneOrderService extends AbstractOrderService<CommuneOrderBean,
private
static
final
String
COMMUNE_ORDER_NAME
=
"公社社员订单"
;
private
static
final
String
COMMUNE_RENEW_ORDER_NAME
=
"续费社员订单"
;
private
static
final
String
commune_voucher_send
=
"commune_voucher_send"
;
//社员发券配置key
private
OperationMessageService
operationMessageService
;
...
...
@@ -61,6 +68,12 @@ public class CommuneOrderService extends AbstractOrderService<CommuneOrderBean,
private
String
communeBaseNotifyUrl
;
private
ClientConfigDao
clientConfigDao
=
null
;
/**
* 980
*/
...
...
@@ -118,6 +131,24 @@ public class CommuneOrderService extends AbstractOrderService<CommuneOrderBean,
}
checkOrderItem
(
communeOrderBean
);
}
//用于订单支付成功之后,做一些发放优惠券之类的活动
public
void
executeOrderActive
(
Order
order
){
ClientConfig
clientConfig
=
clientConfigDao
.
getByType
(
commune_voucher_send
);
//社员订单赠送优惠券配置:431_sendBeginTime_sendEndTime(规则id_开始发送时间_结束发送方式)
String
commune_voucher
=
clientConfig
.
getMessage
();
String
[]
commune_voucher_configs
=
commune_voucher
.
split
(
"_"
);
try
{
Date
sendBeginTime
=
DateUtil
.
parseDateTime
(
commune_voucher_configs
[
1
]);
Date
sendEndTime
=
DateUtil
.
parseDateTime
(
commune_voucher_configs
[
2
]);
Date
now
=
new
Date
();
if
(
sendBeginTime
.
getTime
()<
now
.
getTime
()&&
now
.
getTime
()<
sendEndTime
.
getTime
()){
VoucherRule
voucherRule
=
this
.
getVoucherRuleDao
().
findById
(
Integer
.
parseInt
(
commune_voucher_configs
[
0
]));
this
.
getVoucherDao
().
sendVoucherToSpecificUsers
(
voucherRule
,
order
.
getContactTel
(),
voucherRule
.
getQuantity
());
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
@Override
protected
BigDecimal
getTotalAmount
(
CommuneOrderBean
abstractOrderBean
)
{
...
...
@@ -199,6 +230,8 @@ public class CommuneOrderService extends AbstractOrderService<CommuneOrderBean,
getUserExtDao
().
setUserExtVipGradeCommune
(
order
.
getUid
());
operationMessageService
.
executeSendMessageOfVipCommune
(
order
,
91
);
communeInviteActivityService
.
updateCommuneInviteActivityData
(
order
.
getOrderId
());
//首充会员发放优惠券
this
.
executeOrderActive
(
order
);
}
else
{
getUserExtDao
().
setUserExtVipGradeRenewCommune
(
order
.
getUid
());
operationMessageService
.
executeSendMessageOfVipCommune
(
order
,
110
);
...
...
@@ -486,4 +519,10 @@ public class CommuneOrderService extends AbstractOrderService<CommuneOrderBean,
// TODO Auto-generated method stub
}
public
ClientConfigDao
getClientConfigDao
()
{
return
clientConfigDao
;
}
public
void
setClientConfigDao
(
ClientConfigDao
clientConfigDao
)
{
this
.
clientConfigDao
=
clientConfigDao
;
}
}
src/main/java/com/ctrip/fun/golf/service/payment/AbstractNotifyService.java
View file @
fce9f53f
...
...
@@ -71,9 +71,7 @@ public abstract class AbstractNotifyService extends CorePaymentService {
protected
abstract
void
sendMessage
(
Order
order
,
int
messageId
);
protected
void
executeOrderActive
(
Order
order
){
};
/**
* 支付、退款回调总方法(统一入口)
...
...
src/main/java/com/ctrip/fun/golf/service/payment/CommuneNotifyService.java
View file @
fce9f53f
...
...
@@ -23,7 +23,7 @@ import com.ctrip.fun.golf.service.order.CommuneOrderService;
public
class
CommuneNotifyService
extends
AbstractNotifyService
{
private
static
final
String
commune_voucher_send
=
"commune_voucher_send"
;
private
CommuneOrderService
communeOrderService
=
null
;
...
...
@@ -35,11 +35,7 @@ public class CommuneNotifyService extends AbstractNotifyService {
private
CommuneInviteActivityService
communeInviteActivityService
=
null
;
private
VoucherRuleDao
voucherRuleDao
=
null
;
private
VoucherDao
voucherDao
=
null
;
private
ClientConfigDao
clientConfigDao
=
null
;
...
...
@@ -53,7 +49,7 @@ public class CommuneNotifyService extends AbstractNotifyService {
communeInviteActivityService
.
updateCommuneInviteActivityData
(
order
.
getOrderId
());
sendMessage
(
order
,
91
);
//社员首次充值发放优惠券
this
.
executeOrderActive
(
order
);
communeOrderService
.
executeOrderActive
(
order
);
}
else
{
getUserExtDao
().
setUserExtVipGradeRenewCommune
(
order
.
getUid
());
sendMessage
(
order
,
110
);
...
...
@@ -79,24 +75,6 @@ public class CommuneNotifyService extends AbstractNotifyService {
operationMessageService
.
executeSendMessageOfVipCommune
(
order
,
messageId
);
}
//用于订单支付成功之后,做一些发放优惠券之类的活动
public
void
executeOrderActive
(
Order
order
){
ClientConfig
clientConfig
=
clientConfigDao
.
getByType
(
commune_voucher_send
);
//社员订单赠送优惠券配置:431_sendBeginTime_sendEndTime(规则id_开始发送时间_结束发送方式)
String
commune_voucher
=
clientConfig
.
getMessage
();
String
[]
commune_voucher_configs
=
commune_voucher
.
split
(
"_"
);
try
{
Date
sendBeginTime
=
DateUtil
.
parseDateTime
(
commune_voucher_configs
[
1
]);
Date
sendEndTime
=
DateUtil
.
parseDateTime
(
commune_voucher_configs
[
2
]);
Date
now
=
new
Date
();
if
(
sendBeginTime
.
getTime
()<
now
.
getTime
()&&
now
.
getTime
()<
sendEndTime
.
getTime
()){
VoucherRule
voucherRule
=
voucherRuleDao
.
findById
(
Integer
.
parseInt
(
commune_voucher_configs
[
0
]));
voucherDao
.
sendVoucherToSpecificUsers
(
voucherRule
,
order
.
getContactTel
(),
voucherRule
.
getQuantity
());
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
}
@Override
protected
void
doSuccessRefund
(
Order
order
)
{
...
...
@@ -156,31 +134,4 @@ public class CommuneNotifyService extends AbstractNotifyService {
public
void
setCommuneInviteActivityService
(
CommuneInviteActivityService
communeInviteActivityService
)
{
this
.
communeInviteActivityService
=
communeInviteActivityService
;
}
public
VoucherRuleDao
getVoucherRuleDao
()
{
return
voucherRuleDao
;
}
public
void
setVoucherRuleDao
(
VoucherRuleDao
voucherRuleDao
)
{
this
.
voucherRuleDao
=
voucherRuleDao
;
}
public
VoucherDao
getVoucherDao
()
{
return
voucherDao
;
}
public
void
setVoucherDao
(
VoucherDao
voucherDao
)
{
this
.
voucherDao
=
voucherDao
;
}
public
ClientConfigDao
getClientConfigDao
()
{
return
clientConfigDao
;
}
public
void
setClientConfigDao
(
ClientConfigDao
clientConfigDao
)
{
this
.
clientConfigDao
=
clientConfigDao
;
}
}
src/main/resources/order.spring.xml
View file @
fce9f53f
...
...
@@ -195,6 +195,7 @@
<property
name=
"communeBaseNotifyUrl"
value=
"${payment.communeBaseNotifyUrl}"
></property>
<property
name=
"COMMUNE_AMOUNT"
value=
"${communeAmount}"
></property>
<property
name=
"COMMUNE_AMOUNT2"
value=
"${communeAmount2}"
></property>
<property
name=
"clientConfigDao"
ref=
"clientConfigDao"
></property>
</bean>
<bean
name=
"vipmemberOrderService"
class=
"com.ctrip.fun.golf.service.order.VipMemberOrderService"
parent=
"abstractOrderService"
>
...
...
src/main/resources/payment.spring.xml
View file @
fce9f53f
...
...
@@ -105,10 +105,6 @@
<property
name=
"communeInviteActivityDao"
ref=
"communeInviteActivityDao"
></property>
<property
name=
"communeOrderItemDao"
ref=
"communeOrderItemDao"
></property>
<property
name=
"communeInviteActivityService"
ref=
"communeInviteActivityService"
></property>
<property
name=
"voucherRuleDao"
ref=
"voucherRuleDao"
></property>
<property
name=
"voucherDao"
ref=
"voucherDao"
></property>
<property
name=
"clientConfigDao"
ref=
"clientConfigDao"
></property>
</bean>
<bean
name=
"vipmemberNotifyService"
class=
"com.ctrip.fun.golf.service.payment.VipMemberNotifyService"
>
...
...
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