Commit 0ec80986 by caosy

会员专享抵扣劵

parent 4e3866bd
Showing with 353 additions and 73 deletions
......@@ -8,7 +8,7 @@ public enum ActivityTypeCodeEnum {
/**
* 套票
*/
PACKAGE(1, "套票"),
PACKAGE(1, "套票产品"),
/**
*培训产品
*/
......@@ -16,7 +16,11 @@ public enum ActivityTypeCodeEnum {
/**
*培训产品
*/
SVIP(3, "超级会员"),
SVIP(3, "会员产品"),
/**
* 实物
*/
PHYSICAL(4, "实物产品"),
;
private Integer value;
......@@ -35,6 +39,10 @@ public enum ActivityTypeCodeEnum {
}
}
public static ActivityTypeCodeEnum valueOf(int value) {
return map.get(value);
}
public Integer getValue() {
return value;
}
......
......@@ -40,7 +40,9 @@ public class BuyVoucherActivityBean implements Serializable {
private Integer overdueCanBuy; //过期会员购买 1-不可以 2-可以
private Integer activityType; //产品类型 1-套票 2-培训产品 3-超级会员
private Integer activityType; //产品类型 1-套票 2-培训产品 3-超级会员 4-实物
private String activityTypeMsg;
public Integer getVoucherType() {
return voucherType;
}
......@@ -269,4 +271,12 @@ public class BuyVoucherActivityBean implements Serializable {
this.activityType = activityType;
}
public String getActivityTypeMsg() {
return activityTypeMsg;
}
public void setActivityTypeMsg(String activityTypeMsg) {
this.activityTypeMsg = activityTypeMsg;
}
}
......@@ -25,7 +25,7 @@ public class BuyVoucherActivityQuery extends AbstractPagedQuery {
private Integer voucherType; //卷类型 1 -正常卷 2-体验卷需要身份证
private Integer showPaths; //显示途径 1-App 2-小程序 3-全部
private Integer overdueCanBuy; //过期会员购买 1-不可以 2-可以
private Integer activityType; //产品类型 1-套票 2-培训产品 3-超级会员
private Integer activityType; //产品类型 1-套票 2-培训产品 3-超级会员 4-实物
......
package com.ctrip.fun.common.vo.basic;
import java.util.Date;
/**
* 通用
* @author yuechuan
*
*/
public class GeneralVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBean{
private static final long serialVersionUID = 4101212688944997275L;
/**
* 资源ID
*/
private int resourceId;
/**
* 产品ID
*/
private int productId;
/**
* 购买日期
*/
private Date buyDate;
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;
}
public Date getBuyDate() {
return buyDate;
}
public void setBuyDate(Date buyDate) {
this.buyDate = buyDate;
}
}
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 yuechuan
*
*/
public class GeneralVoucherRuleConditionBean extends AbstractRuleConditionBean<GeneralVoucherRuleConditionBaseBean>{
@Override
public boolean isEnableUse(GeneralVoucherRuleConditionBaseBean t) {
if (this.getType() == 1) {
return true;
} else if (getType() == 2) {
// 转换数据(产品ID、资源ID)
List<Integer> productIdList = 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));
}
}
}
boolean isEnableProduct = true, isEnableProductStartDate = true, isEnableProductEndDate = true;
if (!CollectionUtils.isEmpty(productIdList) && productIdList.contains(t.getProductId())) {
isEnableProduct = false;
}
if (getProductStartDate() != null && t.getBuyDate() != null && getProductStartDate().after(t.getBuyDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getBuyDate() != null && getProductEndDate().before(t.getBuyDate())) {
isEnableProductEndDate = false;
}
if ( isEnableProductStartDate && isEnableProductEndDate && isEnableProduct) {
return true;
}
}
return false;
}
}
......@@ -11,7 +11,7 @@ import org.springframework.util.StringUtils;
* @author DELL
*
*/
public class TourVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBean{
public class PhysicalVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBean{
private static final long serialVersionUID = 4101212688944997275L;
/**
......@@ -24,6 +24,11 @@ public class TourVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseB
*/
private int productId;
/**
* 购买日期
*/
private Date buyDate;
public int getResourceId() {
return resourceId;
......@@ -41,5 +46,12 @@ public class TourVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseB
this.productId = productId;
}
public Date getBuyDate() {
return buyDate;
}
public void setBuyDate(Date buyDate) {
this.buyDate = buyDate;
}
}
......@@ -6,25 +6,19 @@ import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 会员专享套票
* 实物套票
* @author DELL
*
*/
public class TourVoucherRuleConditionBean extends AbstractRuleConditionBean<CourseRuleConditionBaseBean>{
public class PhysicalVoucherRuleConditionBean extends AbstractRuleConditionBean<PhysicalVoucherRuleConditionBaseBean>{
@Override
public boolean isEnableUse(CourseRuleConditionBaseBean t) {
// TODO Auto-generated method stub
return false;
}
/*@Override
public boolean isEnableUse(CourseRuleConditionBaseBean t) {
public boolean isEnableUse(PhysicalVoucherRuleConditionBaseBean 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) {
......@@ -33,31 +27,21 @@ public class TourVoucherRuleConditionBean extends AbstractRuleConditionBean<Cour
}
}
}
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())) {
boolean isEnableProduct = 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())) {
if (getProductStartDate() != null && t.getBuyDate() != null && getProductStartDate().after(t.getBuyDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getPlayDate() != null && getProductEndDate().before(t.getPlayDate())) {
if (getProductEndDate() != null && t.getBuyDate() != null && getProductEndDate().before(t.getBuyDate())) {
isEnableProductEndDate = false;
}
if (isEnableProduct && isEnableResource && isEnableProductStartDate && isEnableProductEndDate) {
if ( isEnableProductStartDate && isEnableProductEndDate && isEnableProduct) {
return true;
}
}
return false;
}*/
}
}
package com.ctrip.fun.common.vo.basic;
import java.util.Date;
public class TicketVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBean{
private static final long serialVersionUID = 4101212688944997275L;
/**
* 资源ID
*/
private int resourceId;
/**
* 产品ID
*/
private int productId;
/**
* 购买日期
*/
private Date buyDate;
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;
}
public Date getBuyDate() {
return buyDate;
}
public void setBuyDate(Date buyDate) {
this.buyDate = buyDate;
}
}
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 yuechuan
*
*/
public class TicketVoucherRuleConditionBean extends AbstractRuleConditionBean<TicketVoucherRuleConditionBaseBean>{
/**
* 暂时不验证
*/
@Override
public boolean isEnableUse(TicketVoucherRuleConditionBaseBean t) {
if (this.getType() == 1) {
return true;
} else if (getType() == 2) {
// 转换数据(产品ID、资源ID)
List<Integer> productIdList = 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));
}
}
}
boolean isEnableProduct = true, isEnableProductStartDate = true, isEnableProductEndDate = true;
if (!CollectionUtils.isEmpty(productIdList) && productIdList.contains(t.getProductId())) {
isEnableProduct = false;
}
if (getProductStartDate() != null && t.getBuyDate() != null && getProductStartDate().after(t.getBuyDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getBuyDate() != null && getProductEndDate().before(t.getBuyDate())) {
isEnableProductEndDate = false;
}
if ( isEnableProductStartDate && isEnableProductEndDate && isEnableProduct) {
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
* 套票
* @author yuechuan
*
*/
public class TrainVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBean{
private static final long serialVersionUID = 4101212688944997275L;
private static final long serialVersionUID = 4101212688944997215L;
/**
* 资源ID
......@@ -24,6 +21,10 @@ public class TrainVoucherRuleConditionBaseBean extends AbstractRuleConditionBase
*/
private int productId;
/**
* 购买日期
*/
private Date buyDate;
public int getResourceId() {
return resourceId;
......@@ -42,4 +43,12 @@ public class TrainVoucherRuleConditionBaseBean extends AbstractRuleConditionBase
}
public Date getBuyDate() {
return buyDate;
}
public void setBuyDate(Date buyDate) {
this.buyDate = buyDate;
}
}
......@@ -5,26 +5,22 @@ import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 会员专享套票
* @author DELL
* 培训券
* @author yuechuan
*
*/
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) {
......@@ -33,31 +29,20 @@ public class TrainVoucherRuleConditionBean extends AbstractRuleConditionBean<Tra
}
}
}
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())) {
boolean isEnableProduct = 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())) {
if (getProductStartDate() != null && t.getBuyDate() != null && getProductStartDate().after(t.getBuyDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getPlayDate() != null && getProductEndDate().before(t.getPlayDate())) {
if (getProductEndDate() != null && t.getBuyDate() != null && getProductEndDate().before(t.getBuyDate())) {
isEnableProductEndDate = false;
}
if (isEnableProduct && isEnableResource && isEnableProductStartDate && isEnableProductEndDate) {
if ( isEnableProductStartDate && isEnableProductEndDate && isEnableProduct) {
return true;
}
}
return false;
}*/
}
}
......@@ -7,7 +7,7 @@ import java.util.List;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
/**
* 培训产品套票
*会员产品套票
* @author DELL
*
*/
......@@ -24,6 +24,10 @@ public class VipVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBe
*/
private int productId;
/**
* 购买日期
*/
private Date buyDate;
public int getResourceId() {
return resourceId;
......@@ -42,4 +46,12 @@ public class VipVoucherRuleConditionBaseBean extends AbstractRuleConditionBaseBe
}
public Date getBuyDate() {
return buyDate;
}
public void setBuyDate(Date buyDate) {
this.buyDate = buyDate;
}
}
......@@ -6,18 +6,45 @@ 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
if (this.getType() == 1) {
return true;
} else if (getType() == 2) {
// 转换数据(产品ID)
List<Integer> productIdList = 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));
}
}
}
boolean isEnableProduct = true, isEnableProductStartDate = true, isEnableProductEndDate = true;
if (!CollectionUtils.isEmpty(productIdList) && productIdList.contains(t.getProductId())) {
isEnableProduct = false;
}
if (getProductStartDate() != null && t.getBuyDate() != null && getProductStartDate().after(t.getBuyDate())) {
isEnableProductStartDate = false;
}
if (getProductEndDate() != null && t.getBuyDate() != null && getProductEndDate().before(t.getBuyDate())) {
isEnableProductEndDate = false;
}
if ( isEnableProductStartDate && isEnableProductEndDate && isEnableProduct) {
return true;
}
}
return false;
}
}
......@@ -19,11 +19,15 @@ public enum VoucherTypeEnum {
EVENT_ACTIVITY(4, "赛事活动", new EventActivityRuleConditionBean()),
TOUR_VOUCHER(5, "套票券", new TourVoucherRuleConditionBean()),
PHYSICAL_VOUCHER(5, "实物劵", new PhysicalVoucherRuleConditionBean()),
TRAIN_VOUCHER(6, "培训券", new TrainVoucherRuleConditionBean()),
VIP_VOUCHER(6, "会员券(入社、续费)", new VipVoucherRuleConditionBean()),
VIP_VOUCHER(7, "会员券", new VipVoucherRuleConditionBean());
TICKET_VOUCHER(7, "套票券", new TicketVoucherRuleConditionBean()),
TRAIN_VOUCHER(8, "培训券", new TrainVoucherRuleConditionBean()),
GENERAL_VOUCHER(9, "通用劵(会员、套票、培训)", new GeneralVoucherRuleConditionBean());
private int value;
private String msg;
......@@ -76,11 +80,15 @@ public enum VoucherTypeEnum {
case 4:
return new EventActivityRuleConditionBean();
case 5:
return new TourVoucherRuleConditionBean();
return new PhysicalVoucherRuleConditionBean();
case 6:
return new TrainVoucherRuleConditionBean();
case 7:
return new VipVoucherRuleConditionBean();
case 7:
return new TicketVoucherRuleConditionBean();
case 8:
return new TrainVoucherRuleConditionBean();
case 9:
return new GeneralVoucherRuleConditionBean();
default:
return null;
}
......@@ -102,5 +110,25 @@ public enum VoucherTypeEnum {
public boolean isMallProductRuleConditionBean() {
return ruleConditionBean instanceof MallProductRuleConditionBean;
}
public boolean isPhysicalVoucherRuleConditionBean() {
return ruleConditionBean instanceof PhysicalVoucherRuleConditionBean;
}
public boolean isVipVoucherRuleConditionBean() {
return ruleConditionBean instanceof VipVoucherRuleConditionBean;
}
public boolean isTicketVoucherRuleConditionBean() {
return ruleConditionBean instanceof TicketVoucherRuleConditionBean;
}
public boolean isTrainVoucherRuleConditionBean() {
return ruleConditionBean instanceof TrainVoucherRuleConditionBean;
}
public boolean isGeneralVoucherRuleConditionBean() {
return ruleConditionBean instanceof GeneralVoucherRuleConditionBean;
}
}
......@@ -3,6 +3,7 @@
*/
package com.ctrip.fun.common.vo.order;
import java.math.BigDecimal;
import java.util.List;
/**
......@@ -90,6 +91,8 @@ public class CommuneOrderBean extends
public String getRecommendCode() {
return recommendCode;
}
......
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