diff --git a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java index 9ce53d899..00200106f 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/WxCoupon.java @@ -441,74 +441,94 @@ public class WxCoupon extends TenantEntity { } public boolean validDate(boolean isShare,boolean hasShareAmount,Date curr) { - Map retMap = calcuteValidDate(isShare, hasShareAmount, curr); - int success = (int) retMap.get("success"); - if (success > 0) { + if(this.getType().equals(EnumCouponType.COUPON_DOUYIN.getCode())){ return true; - }else { - return false; } + if(isShare){ + Date valid_date = getOuterRealValidDate(curr); + Date limit_date = DateUtils.getTimeAfterDays(Constant.WX_LIMIT_DAYS, curr); + if (valid_date.after(limit_date)) { + return false; + } + } + return true; + + +// Map retMap = calcuteValidDate(isShare, hasShareAmount, curr); +// int success = (int) retMap.get("success"); +// if (success > 0) { +// return true; +// }else { +// return false; +// } } public Date getRealValidDate(boolean isShare,boolean hasShareAmount,Date curr) { - Map retMap = calcuteValidDate(isShare,hasShareAmount,curr); - return (Date) retMap.get("realDate"); + //券都上架卖出去了还判断个什么有效期 +// Map retMap = calcuteValidDate(isShare,hasShareAmount,curr); +// return (Date) retMap.get("realDate"); + return getOuterRealValidDate(curr); } - private Map calcuteValidDate(boolean isShare,boolean hasShareAmount,Date curr) { - int limit_days = Constant.WX_LIMIT_DAYS; - int success = 1; - Date valid_date = null; - if (this.getValidType().equals(EnumValidStatus.VALID_RANGE.getCode()) || - this.getType().equals(EnumCouponType.COUPON_TINGCHE.getCode())) { - - if( this.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())){ - valid_date = this.getPickEndDate(); - }else{ - valid_date = this.getValidEndDate(); - } - if (this.getSalePrice() > 0 && !this.checkIsCard()) { - if (hasShareAmount) { - if (isShare) { - // 分账有价券核销有效期不能大于分账过期时间 - Date limit_date = DateUtils.getTimeAfterDays(limit_days, curr); - if (valid_date.after(limit_date)) { - valid_date = limit_date; - success = 0; - } - } - } - } - } else { - if (this.getSalePrice() > 0 && !this.checkIsCard()) { - if (hasShareAmount) { - // 分账有价券核销有效期不能大于分账过期时间 - if (isShare) { - if (this.getValidDays() < Constant.WX_LIMIT_DAYS) { - limit_days = this.getValidDays(); - }else { - success = 0; - } - }else { - limit_days = this.getValidDays(); - } - }else{ - limit_days = this.getValidDays(); - } - } else { - limit_days = this.getValidDays(); - } - valid_date = DateUtils.getTimeAfterDays(limit_days, curr); - } - Map retMap = new HashMap(); - retMap.put("success", success); - retMap.put("realDate", valid_date); - return retMap; - } +// private Map calcuteValidDate(boolean isShare,boolean hasShareAmount,Date curr) { +// if(this.getType().equals(EnumCouponType.COUPON_DOUYIN.getCode())){ +// Map retMap = new HashMap(); +// retMap.put("success", 1); +// retMap.put("realDate", getOuterRealValidDate(new Date())); +// return retMap; +// } +// int limit_days = Constant.WX_LIMIT_DAYS; +// int success = 1; +// Date valid_date = null; +// if (this.getValidType().equals(EnumValidStatus.VALID_RANGE.getCode()) || +// this.getType().equals(EnumCouponType.COUPON_TINGCHE.getCode())) { +// +// if( this.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())){ +// valid_date = this.getPickEndDate(); +// }else{ +// valid_date = this.getValidEndDate(); +// } +// if (this.getSalePrice() > 0 && !this.checkIsCard()) { +// if (hasShareAmount) { +// if (isShare) { +// // 分账有价券核销有效期不能大于分账过期时间 +// Date limit_date = DateUtils.getTimeAfterDays(limit_days, curr); +// if (valid_date.after(limit_date)) { +// valid_date = limit_date; +// success = 0; +// } +// } +// } +// } +// } else { +// if (this.getSalePrice() > 0 && !this.checkIsCard()) { +// if (hasShareAmount) { +// // 分账有价券核销有效期不能大于分账过期时间 +// if (isShare) { +// if (this.getValidDays() < Constant.WX_LIMIT_DAYS) { +// limit_days = this.getValidDays(); +// }else { +// success = 0; +// } +// }else { +// limit_days = this.getValidDays(); +// } +// }else{ +// limit_days = this.getValidDays(); +// } +// } else { +// limit_days = this.getValidDays(); +// } +// valid_date = DateUtils.getTimeAfterDays(limit_days, curr); +// } +// Map retMap = new HashMap(); +// retMap.put("success", success); +// retMap.put("realDate", valid_date); +// return retMap; +// } public Date getOuterRealValidDate(Date curr) { - int limit_days = Constant.WX_LIMIT_DAYS; Date valid_date = null; if (this.getValidType().equals(EnumValidStatus.VALID_RANGE.getCode())) { if( this.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())){ @@ -517,7 +537,7 @@ public class WxCoupon extends TenantEntity { valid_date = this.getValidEndDate(); } } else { - limit_days = this.getValidDays(); + int limit_days = this.getValidDays(); valid_date = DateUtils.getTimeAfterDays(limit_days, curr); } return valid_date;