|
|
|
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
@@ -259,9 +260,19 @@ public class WxOrderServiceImpl implements WxOrderService { |
|
|
|
*/ |
|
|
|
private void createCouponOrder(WxCUser user, WxOrder order, WxCoupon coupon) { |
|
|
|
Date curr = new Date(); |
|
|
|
Date valid_date = (coupon.getValidType() == EnumValidStatus.VALID_RANGE.getCode()) ? |
|
|
|
coupon.getValidEndDate() : |
|
|
|
new Date((curr.getTime() / 1000 + coupon.getValidDays() * 24 * 60 * 60) * 1000); |
|
|
|
Date valid_date = null; |
|
|
|
if (coupon.getValidType() == EnumValidStatus.VALID_RANGE.getCode()) |
|
|
|
valid_date = coupon.getValidEndDate(); |
|
|
|
else { |
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
calendar.setTime(curr); |
|
|
|
// 普通券精确到天 |
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0); |
|
|
|
calendar.set(Calendar.MINUTE, 0); |
|
|
|
calendar.set(Calendar.SECOND, 0); |
|
|
|
Date zero = calendar.getTime(); |
|
|
|
valid_date = new Date(zero.getTime() + (coupon.getValidDays()+1) * 24 * 60 * 60 * 1000); |
|
|
|
} |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
|
|
|
|
WxCouponOrder couponOrder = new WxCouponOrder(); |
|
|
|
|