Commit 5604e2c3 by ping.wu

积分商城兑换券校验

parent 8639e3f1
package cn.freemud.entities;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
public class Active {
@JSONField(
name = "ActiveId"
)
private Integer ActiveId;
@JSONField(
name = "EBCode"
)
private String EBCode;
@JSONField(
name = "Type"
)
private Integer Type;
@JSONField(
name = "PartnerID"
)
private Integer PartnerID;
@JSONField(
name = "PlatformItemId"
)
private String PlatformItemId;
@JSONField(
name = "State"
)
private Integer State;
@JSONField(
name = "CreateUser"
)
private String CreateUser;
@JSONField(
name = "CreateDate"
)
private String CreateDate;
@JSONField(
name = "LastEditUser"
)
private String LastEditUser;
@JSONField(
name = "LastEditDate"
)
private String LastEditDate;
@JSONField(
name = "ActiveCode"
)
private String ActiveCode;
@JSONField(
name = "ActiveName"
)
private String ActiveName;
@JSONField(
name = "StartDate"
)
private String StartDate;
@JSONField(
name = "EndDate"
)
private String EndDate;
@JSONField(
name = "ShouldRedeemAll"
)
private Boolean ShouldRedeemAll;
@JSONField(
name = "PromotionType"
)
private String PromotionType;
@JSONField(
name = "Exclusive"
)
private Boolean Exclusive;
@JSONField(
name = "MinAmount"
)
private BigDecimal MinAmount;
@JSONField(
name = "MaxRedeemTimes"
)
private Integer MaxRedeemTimes;
@JSONField(
name = "MaxSendOut"
)
private Integer MaxSendOut;
@JSONField(
name = "Cost"
)
private BigDecimal Cost;
@JSONField(
name = "BusinessID"
)
private Integer BusinessID;
@JSONField(
name = "ActiveDesc"
)
private String ActiveDesc;
@JSONField(
name = "Percentage"
)
private Double percentage;
@JSONField(
name = "Inventory"
)
@JsonProperty("EBCode")
private String ebCode;
private Integer type;
private Integer partnerId;
private String platformItemid;
private String activeCode;
private Integer state;
private String activeName;
private String activeDesc;
private String createUser;
private Date createDate;
private Date startDate;
private Date endDate;
private String lasteditUser;
private Date lasteditDate;
private Boolean shouldRedeemall;
private String promotionType;
private Boolean exclusive;
private BigDecimal minAmount;
private Integer maxRedeemTimes;
private BigDecimal cost;
private Integer businessId;
private BigDecimal percentDiscount;
private BigDecimal maxDiscount;
private BigDecimal originalPrice;
private BigDecimal salePrice;
private Integer timeLimit;
private Integer dailyRedeemTimes;
private Integer stationEnable;
private String redeemChannel;
private String appId;
private Integer fromDayEffective;
private Integer effective;
private Date effectiveStart;
private Date effectiveEnd;
private Date effectiveStartTime;
private Date effectiveEndTime;
private BigDecimal amountDiscount;
private BigDecimal merchantDiscountPrice;
private BigDecimal platformDiscountPrice;
private BigDecimal supplierDiscountPrice;
private String thirdpartyActiveCode;
private Integer storeLimitType;
private Integer limitType;
private String logo;
private String productScopeDesc;
private String storeScopeDesc;
private Integer createType;
private Integer promotionSharing;
private String remark;
private List<String> labelNames;
private List<Integer> labels;
private String cornerIcon;
private String cornerPosition;
private Integer isMarketingTransfer;
private Integer isDonate;
private Integer prestoreCodeNumber;
private Integer inventory;
@JSONField(
name = "PercentDiscount"
)
private BigDecimal PercentDiscount;
@JSONField(
name = "MaxDiscount"
)
private Integer MaxDiscount;
@JSONField(
name = "AppId"
)
private String AppId;
@JSONField(
name = "FromDayEffective"
)
private Integer FromDayEffective;
@JSONField(
name = "Effective"
)
private Integer Effective;
@JSONField(
name = "EffectiveStart"
)
private Date EffectiveStart;
@JSONField(
name = "EffectiveEnd"
)
private Date EffectiveEnd;
@JSONField(
name = "RedeemChannel"
)
private String RedeemChannel;
@JSONField(
name = "MerchantDiscountPrice"
)
private BigDecimal MerchantDiscountPrice;
@JSONField(
name = "PlatformDiscountPrice"
)
private BigDecimal PlatformDiscountPrice;
@JSONField(
name = "OtherDiscountPrice"
)
private BigDecimal OtherDiscountPrice;
private Integer leftInventory;
@JSONField(
name = "salePrice"
)
private Integer salePrice;
@JSONField(
name = "voucherFaceValue"
)
private Integer voucherFaceValue;
/**
* 限购份数, 仅商品兑换券可用
*/
@JSONField(
name = "accountSendOutNum"
)
private Integer accountSendOutNum;
/**
* 每份购买张数, 仅商品兑换券可用
*/
@JSONField(
name = "accountSendOutAmount"
)
private Integer accountSendOutAmount;
// @JSONField(
// name = "ActiveId"
// )
// private Integer ActiveId;
// @JSONField(
// name = "EBCode"
// )
// private String EBCode;
// @JSONField(
// name = "Type"
// )
// private Integer Type;
// @JSONField(
// name = "PartnerID"
// )
// private Integer PartnerID;
// @JSONField(
// name = "PlatformItemId"
// )
// private String PlatformItemId;
// @JSONField(
// name = "State"
// )
// private Integer State;
// @JSONField(
// name = "CreateUser"
// )
// private String CreateUser;
// @JSONField(
// name = "CreateDate"
// )
// private String CreateDate;
// @JSONField(
// name = "LastEditUser"
// )
// private String LastEditUser;
// @JSONField(
// name = "LastEditDate"
// )
// private String LastEditDate;
// @JSONField(
// name = "ActiveCode"
// )
// private String ActiveCode;
// @JSONField(
// name = "ActiveName"
// )
// private String ActiveName;
// @JSONField(
// name = "StartDate"
// )
// private String StartDate;
// @JSONField(
// name = "EndDate"
// )
// private String EndDate;
// @JSONField(
// name = "ShouldRedeemAll"
// )
// private Boolean ShouldRedeemAll;
// @JSONField(
// name = "PromotionType"
// )
// private String PromotionType;
// @JSONField(
// name = "Exclusive"
// )
// private Boolean Exclusive;
// @JSONField(
// name = "MinAmount"
// )
// private BigDecimal MinAmount;
// @JSONField(
// name = "MaxRedeemTimes"
// )
// private Integer MaxRedeemTimes;
// @JSONField(
// name = "MaxSendOut"
// )
// private Integer MaxSendOut;
// @JSONField(
// name = "Cost"
// )
// private BigDecimal Cost;
// @JSONField(
// name = "BusinessID"
// )
// private Integer BusinessID;
// @JSONField(
// name = "ActiveDesc"
// )
// private String ActiveDesc;
// @JSONField(
// name = "Percentage"
// )
// private Double percentage;
// @JSONField(
// name = "Inventory"
// )
// private Integer inventory;
// @JSONField(
// name = "PercentDiscount"
// )
// private BigDecimal PercentDiscount;
// @JSONField(
// name = "MaxDiscount"
// )
// private Integer MaxDiscount;
// @JSONField(
// name = "AppId"
// )
// private String AppId;
// @JSONField(
// name = "FromDayEffective"
// )
// private Integer FromDayEffective;
// @JSONField(
// name = "Effective"
// )
// private Integer Effective;
// @JSONField(
// name = "EffectiveStart"
// )
// private Date EffectiveStart;
// @JSONField(
// name = "EffectiveEnd"
// )
// private Date EffectiveEnd;
// @JSONField(
// name = "RedeemChannel"
// )
// private String RedeemChannel;
// @JSONField(
// name = "MerchantDiscountPrice"
// )
// private BigDecimal MerchantDiscountPrice;
// @JSONField(
// name = "PlatformDiscountPrice"
// )
// private BigDecimal PlatformDiscountPrice;
// @JSONField(
// name = "OtherDiscountPrice"
// )
// private BigDecimal OtherDiscountPrice;
//
// @JSONField(
// name = "salePrice"
// )
// private Integer salePrice;
// @JSONField(
// name = "voucherFaceValue"
// )
// private Integer voucherFaceValue;
// /**
// * 限购份数, 仅商品兑换券可用
// */
// @JSONField(
// name = "accountSendOutNum"
// )
// private Integer accountSendOutNum;
// /**
// * 每份购买张数, 仅商品兑换券可用
// */
// @JSONField(
// name = "accountSendOutAmount"
// )
// private Integer accountSendOutAmount;
}
package cn.freemud.entities;
import java.util.List;
public class BatchQueryActivityInfoResponse {
/**
* 状态码
*/
private String statusCode;
/**
* 状态码描述
*/
private String msg;
private List<Active> activities;
}
//package cn.freemud.entities;
//
//import java.util.List;
//
//public class BatchQueryActivityInfoResponse {
//
// /**
// * 状态码
// */
// private String statusCode;
//
// /**
// * 状态码描述
// */
// private String msg;
//
// private List<Active> activities;
//
//}
......@@ -131,13 +131,15 @@ public class PointsMallOrderServiceImpl implements PointsMallOrderService {
return ResponseUtil.error(batchQueryActivityInfoResponseDto.getStatusCode(), "优惠券异常");
}
active = batchQueryActivityInfoResponseDto.getActivities().get(0);
Date couponValidEnd = getCouponValidEnd(active);
//券商品查询券活动信息校验券有效
//只有1和2能发,一般没有2
List<Integer> canSendCoupon = Arrays.asList(CouponActiveStateEnum.STATE_1.getCode(),CouponActiveStateEnum.STATE_2.getCode());
if(!canSendCoupon.contains(active.getState())){
if(!canSendCoupon.contains(active.getState()) || couponValidEnd == null){
return ResponseUtil.error(ResponseCodeConstant.RESPONSE_ERROR_STR, "优惠券异常");
}
if(getCouponValidEnd(active).after(new Date())){
//券已过期
if(getCouponValidEnd(active).before(new Date())){
return ResponseUtil.error(ResponseCodeConstant.RESPONSE_ERROR_STR, "优惠券已过期,无法兑换");
}
}
......@@ -574,7 +576,7 @@ public class PointsMallOrderServiceImpl implements PointsMallOrderService {
returnDate = DateUtil.addDays(new Date(), (delayTimes + validityPeriod - 1));
}
} else {
returnDate = activeInfo.getEffectiveEnd();
returnDate = activeInfo.getEffectiveEndTime();
}
return returnDate;
}
......
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 to comment