Commit 242fa41d by chongli

增加了onlyMe字段;修改了代金券发送配置

parent 771045f4
......@@ -418,6 +418,7 @@ public class VoucherService {
if (!abstractRuleConditionBean.isEnableUse(courseRuleConditionBaseBean)) {
continue;
}
this.setOnlyMe(vo, abstractRuleConditionBean.getOnlyMe());
}else{
MultipleCourseConditionBean multipleCourseConditionBean = null;
try {
......@@ -429,7 +430,7 @@ public class VoucherService {
continue;
}else{
vo.setAmount(multipleCourseConditionBean.getEnableAmount(courseRuleConditionBaseBean));
this.setOnlyMe(vo, multipleCourseConditionBean.getOnlyMe());
List<ConditionMultipleElement> list = multipleCourseConditionBean.getConditionList();
StringBuffer amountArray = new StringBuffer();
for(ConditionMultipleElement element :list){
......@@ -542,6 +543,7 @@ public class VoucherService {
.isEnableUse(eventActivityRuleConditionBaseBean)) {
continue;
}
this.setOnlyMe(vo, abstractRuleConditionBean.getOnlyMe());
}else{
MultipleCourseConditionBean multipleCourseConditionBean = null;
try {
......@@ -553,7 +555,7 @@ public class VoucherService {
continue;
}else{
vo.setAmount(multipleCourseConditionBean.getEnableAmount(courseRuleConditionBaseBean));
this.setOnlyMe(vo, multipleCourseConditionBean.getOnlyMe());
List<ConditionMultipleElement> list = multipleCourseConditionBean.getConditionList();
StringBuffer amountArray = new StringBuffer();
for(ConditionMultipleElement element :list){
......@@ -761,6 +763,14 @@ public class VoucherService {
}
}
private void setOnlyMe(VoucherItemDTO vo,Integer onlyMe){
if(onlyMe==null){
vo.setOnlyMe(0);
}else{
vo.setOnlyMe(onlyMe);
}
}
public VoucherRuleDao getVoucherRuleDao() {
return voucherRuleDao;
}
......
......@@ -638,6 +638,9 @@ public abstract class AbstractOrderService<H extends AbstractOrderBean<T>, T> ex
if (this.getTotalVoucherAmount(abstractOrderBean.getVoucherList()).compareTo(abstractOrderBean.getVoucherAmount()) != 0) {
throw new OrderException(-5, "抵用券订单金额计算有误");
}
if (abstractOrderBean.getVoucherList().size()>1) {
throw new OrderException(-5, "只能使用一张抵用券");
}
// 发票支付方式选择积分
if (abstractOrderBean.isHasInvoice() && abstractOrderBean.getInvoice().getPayType() == 2) {
if (userExt.getCurrentIntegral() < 1000) {
......
......@@ -13,6 +13,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import com.alibaba.fastjson.JSONObject;
import com.ctrip.fun.common.core.util.DateUtil;
import com.ctrip.fun.common.core.util.StringUtils;
import com.ctrip.fun.common.vo.PagedResponseBean;
......@@ -136,13 +137,13 @@ public class CommuneOrderService extends AbstractOrderService<CommuneOrderBean,
ClientConfig clientConfig = clientConfigDao.getByType(commune_voucher_send);
//社员订单赠送优惠券配置:431_sendBeginTime_sendEndTime(规则id_开始发送时间_结束发送方式)
String commune_voucher = clientConfig.getMessage();
String[] commune_voucher_configs = commune_voucher.split("_");
JSONObject jsobj = JSONObject.parseObject(commune_voucher);
try {
Date sendBeginTime = DateUtil.parseDateTime(commune_voucher_configs[1]);
Date sendEndTime = DateUtil.parseDateTime(commune_voucher_configs[2]);
Date sendBeginTime = DateUtil.parseDateTime(jsobj.getString("sendBeginTime"));
Date sendEndTime = DateUtil.parseDateTime(jsobj.getString("sendEndTime"));
Date now = new Date();
if(sendBeginTime.getTime()<now.getTime()&&now.getTime()<sendEndTime.getTime()){
VoucherRule voucherRule = this.getVoucherRuleDao().findById(Integer.parseInt(commune_voucher_configs[0]));
VoucherRule voucherRule = this.getVoucherRuleDao().findById(Integer.parseInt(jsobj.getString("id")));
this.getVoucherDao().sendVoucherToSpecificUsers(voucherRule, order.getUid(), voucherRule.getQuantity());
}
} catch (ParseException e) {
......
package com.ctrip.fun.golf.dao.statistics.user;
import com.ctrip.fun.common.core.util.DateUtil;
import com.ctrip.fun.common.vo.market.RmdCodeReportQuery;
import com.ctrip.fun.common.vo.market.UserOrderBehaviourStatisticsBean;
import com.ctrip.fun.common.vo.statistics.query.UserStatisticsQuery;
import com.ctrip.fun.common.vo.basic.VoucherQueryDto;
import com.ctrip.fun.golf.dao.order.OrderDao;
import com.ctrip.fun.golf.dao.user.UserOrderBehaviourStatisticsDao;
import com.ctrip.fun.golf.service.basic.VoucherService;
import com.ctrip.fun.golf.service.order.CommuneOrderService;
import com.ctrip.fun.golf.service.payment.CommuneNotifyService;
import com.ctrip.fun.golf.vo.PagedEntityBean;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -16,35 +12,21 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath*:*.spring.xml"})
public class UserOrderBehaviourStatisticsDaoTest{
@Autowired
private UserOrderBehaviourStatisticsDao userOrderBehaviourStatisticsDao;
@Autowired
private CommuneOrderService communeOrderService;
private VoucherService voucherService;
@Autowired
private OrderDao orderDao;
@Test
public void testListNonOrderUser() throws Exception {
communeOrderService.executeOrderActive(orderDao.getOrderByID(1317857115));
VoucherQueryDto query = new VoucherQueryDto();
query.setUid("13198765437");
query.setType(1);
query.setResourceId(2972);
voucherService.queryListForCourseOrder(query);
}
@Test
......
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