Commit fce9f53f by chongli

980首次充值,余额付款,走支付接口的付款都发放优惠券

parent d885d279
......@@ -430,6 +430,10 @@ public abstract class AbstractOrderService<H extends AbstractOrderBean<T>, T> ex
return null;
}
//执行一营销活动的代码
protected void executeOrderActive(Order order){
};
/**
* 判断订单是否可删除
......
......@@ -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;
}
}
......@@ -71,9 +71,7 @@ public abstract class AbstractNotifyService extends CorePaymentService {
protected abstract void sendMessage(Order order, int messageId);
protected void executeOrderActive(Order order){
};
/**
* 支付、退款回调总方法(统一入口)
......
......@@ -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;
}
}
......@@ -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">
......
......@@ -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">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment