Commit a4a70bc8 by unknown

add the flashsale res limite

parent 19988147
...@@ -2,6 +2,8 @@ package com.ctrip.fun.golf.service.product; ...@@ -2,6 +2,8 @@ package com.ctrip.fun.golf.service.product;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.BitSet; import java.util.BitSet;
import java.util.Calendar; import java.util.Calendar;
...@@ -803,6 +805,11 @@ public class CourseResourceService extends ...@@ -803,6 +805,11 @@ public class CourseResourceService extends
if (startTime == null) { if (startTime == null) {
return FlashSaleStatusEnum.INVALID_PARAMETER.getValue();// 参数非法 return FlashSaleStatusEnum.INVALID_PARAMETER.getValue();// 参数非法
} }
if(priceDate !=null && DateUtil.getDistinceDay(new Date(), priceDate) < 0){
//已经过期的 资源,打球日期早于今天的资源不能抢购了
return FlashSaleStatusEnum.RESOURCE_NOT_FOUND.getValue();// 资源不存在
}
long startSec = startTime.getTime(); long startSec = startTime.getTime();
long now = this.asmCourseResourceDao.getCurrentTime().getTime(); long now = this.asmCourseResourceDao.getCurrentTime().getTime();
if (now < startSec) if (now < startSec)
...@@ -1001,10 +1008,11 @@ public class CourseResourceService extends ...@@ -1001,10 +1008,11 @@ public class CourseResourceService extends
//add by caosy: //add by caosy:
name = name + "-"+DateUtil.chineseDayForWeek(asmCourseResource.getPriceDate()); name = name + "-"+DateUtil.chineseDayForWeek(asmCourseResource.getPriceDate());
BigDecimal priceDelta = new BigDecimal(asmCourseResource.getMarketPrice().toString()).subtract(new BigDecimal(asmCourseResource.getSalePrice().toString())); BigDecimal priceDelta = new BigDecimal(asmCourseResource.getMarketPrice().toString()).subtract(new BigDecimal(asmCourseResource.getSalePrice().toString()));
DecimalFormat nf = new DecimalFormat("#");
if(asmCourseResource.getCashRebate() > 0){ if(asmCourseResource.getCashRebate() > 0){
name = name + "爱玩返现"+asmCourseResource.getCashRebate()+"元"; name = name + "爱玩返现"+nf.format(asmCourseResource.getCashRebate())+"元";
}else if(priceDelta.doubleValue() > 0){ }else if(priceDelta.doubleValue() > 0){
name = name + "爱玩补贴"+ priceDelta.doubleValue()+"元"; name = name + "爱玩补贴"+ nf.format(priceDelta.doubleValue())+"元";
} }
Date startDate = asmCourseResource.getPriceDate(); Date startDate = asmCourseResource.getPriceDate();
String startTime = asmCourseResource.getStartTime(); String startTime = asmCourseResource.getStartTime();
......
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