Commit cb2dd087 by zhangchen

优惠券添加分类

parent 22d14fd6
package com.ctrip.fun.common.vo.basic;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 会员专享套票
* @author DELL
*
*/
public class TourVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBean{
private static final long serialVersionUID = 4101212688944997275L;
/**
* 资源ID
*/
private int resourceId;
/**
* 产品ID
*/
private int productId;
public int getResourceId() {
return resourceId;
}
public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}
public int getProductId() {
return productId;
}
public void setProductId(int productId) {
this.productId = productId;
}
}
package com.ctrip.fun.common.vo.basic;
import java.util.ArrayList;
import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 会员专享套票
* @author DELL
*
*/
public class TourVoucherRuleConditionBean extends AbstractRuleConditionBean<CourseRuleConditionBaseBean>{
@Override
public boolean isEnableUse(CourseRuleConditionBaseBean t) {
// TODO Auto-generated method stub
return false;
}
/*@Override
public boolean isEnableUse(CourseRuleConditionBaseBean t) {
if (this.getType() == 1) {
return true;
} else if (getType() == 2) {
// 转换数据(产品ID、资源ID)
List<Integer> productIdList = new ArrayList<Integer>();
List<Integer> resourceIdList = new ArrayList<Integer>();
if (StringUtils.hasText(this.getValue())) {
String[] productIdArray = this.getValue().split(",");
for (String s : productIdArray) {
if (StringUtils.hasText(s)) {
productIdList.add(Integer.valueOf(s));
}
}
}
if (StringUtils.hasText(this.getResourceIds())) {
String[] resourceIdArray = this.getResourceIds().split(",");
for (String s : resourceIdArray) {
if (StringUtils.hasText(s)) {
resourceIdList.add(Integer.valueOf(s));
}
}
}
boolean isEnableProduct = true, isEnableResource = true, isEnableProductStartDate = true, isEnableProductEndDate = true;
if (!CollectionUtils.isEmpty(productIdList) && !productIdList.contains(t.getProductId())) {
isEnableProduct = false;
}
if (!CollectionUtils.isEmpty(resourceIdList) && !resourceIdList.contains(t.getResourceId())) {
isEnableResource = false;
}
if (getProductStartDate() != null && t.getPlayDate() != null && getProductStartDate().after(t.getPlayDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getPlayDate() != null && getProductEndDate().before(t.getPlayDate())) {
isEnableProductEndDate = false;
}
if (isEnableProduct && isEnableResource && isEnableProductStartDate && isEnableProductEndDate) {
return true;
}
}
return false;
}*/
}
package com.ctrip.fun.common.vo.basic;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 培训产品套票
* @author DELL
*
*/
public class TrainVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBean{
private static final long serialVersionUID = 4101212688944997275L;
/**
* 资源ID
*/
private int resourceId;
/**
* 产品ID
*/
private int productId;
public int getResourceId() {
return resourceId;
}
public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}
public int getProductId() {
return productId;
}
public void setProductId(int productId) {
this.productId = productId;
}
}
package com.ctrip.fun.common.vo.basic;
import java.util.ArrayList;
import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 会员专享套票
* @author DELL
*
*/
public class TrainVoucherRuleConditionBean extends AbstractRuleConditionBean<TrainVoucherRuleConditionBaseBean>{
@Override
public boolean isEnableUse(TrainVoucherRuleConditionBaseBean t) {
// TODO Auto-generated method stub
return false;
}
/* @Override
public boolean isEnableUse(CourseRuleConditionBaseBean t) {
if (this.getType() == 1) {
return true;
} else if (getType() == 2) {
// 转换数据(产品ID、资源ID)
List<Integer> productIdList = new ArrayList<Integer>();
List<Integer> resourceIdList = new ArrayList<Integer>();
if (StringUtils.hasText(this.getValue())) {
String[] productIdArray = this.getValue().split(",");
for (String s : productIdArray) {
if (StringUtils.hasText(s)) {
productIdList.add(Integer.valueOf(s));
}
}
}
if (StringUtils.hasText(this.getResourceIds())) {
String[] resourceIdArray = this.getResourceIds().split(",");
for (String s : resourceIdArray) {
if (StringUtils.hasText(s)) {
resourceIdList.add(Integer.valueOf(s));
}
}
}
boolean isEnableProduct = true, isEnableResource = true, isEnableProductStartDate = true, isEnableProductEndDate = true;
if (!CollectionUtils.isEmpty(productIdList) && !productIdList.contains(t.getProductId())) {
isEnableProduct = false;
}
if (!CollectionUtils.isEmpty(resourceIdList) && !resourceIdList.contains(t.getResourceId())) {
isEnableResource = false;
}
if (getProductStartDate() != null && t.getPlayDate() != null && getProductStartDate().after(t.getPlayDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getPlayDate() != null && getProductEndDate().before(t.getPlayDate())) {
isEnableProductEndDate = false;
}
if (isEnableProduct && isEnableResource && isEnableProductStartDate && isEnableProductEndDate) {
return true;
}
}
return false;
}*/
}
package com.ctrip.fun.common.vo.basic;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 培训产品套票
* @author DELL
*
*/
public class VipVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBean{
private static final long serialVersionUID = 4101212688944997275L;
/**
* 资源ID
*/
private int resourceId;
/**
* 产品ID
*/
private int productId;
public int getResourceId() {
return resourceId;
}
public void setResourceId(int resourceId) {
this.resourceId = resourceId;
}
public int getProductId() {
return productId;
}
public void setProductId(int productId) {
this.productId = productId;
}
}
package com.ctrip.fun.common.vo.basic;
import java.util.ArrayList;
import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 会员专享套票
* @author DELL
*
*/
public class VipVoucherRuleConditionBean extends AbstractRuleConditionBean<VipVoucherRuleConditionBaseBean>{
/**
* 暂时不验证
*/
@Override
public boolean isEnableUse(VipVoucherRuleConditionBaseBean t) {
// TODO Auto-generated method stub
return false;
}
}
......@@ -17,7 +17,13 @@ public enum VoucherTypeEnum {
MALL(3, "商城", new MallProductRuleConditionBean()),
EVENT_ACTIVITY(4, "赛事活动", new EventActivityRuleConditionBean());
EVENT_ACTIVITY(4, "赛事活动", new EventActivityRuleConditionBean()),
TOUR_VOUCHER(5, "套票券", new TourVoucherRuleConditionBean()),
TRAIN_VOUCHER(6, "培训券", new TrainVoucherRuleConditionBean()),
VIP_VOUCHER(7, "会员券", new VipVoucherRuleConditionBean());
private int value;
private String msg;
......@@ -69,6 +75,12 @@ public enum VoucherTypeEnum {
return new MallProductRuleConditionBean();
case 4:
return new EventActivityRuleConditionBean();
case 5:
return new TourVoucherRuleConditionBean();
case 6:
return new TrainVoucherRuleConditionBean();
case 7:
return new VipVoucherRuleConditionBean();
default:
return null;
}
......
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