|
|
|
@@ -80,9 +80,20 @@ public class TtOrderServiceImpl implements TtOrderService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public ResultData saveOrder(Long couponId,Long cUserId,EnumPayWay payWay,TenantEntity tenantEntity) { |
|
|
|
public ResultData saveOrder(Long couponId,Long cUserId,EnumPayWay payWay) { |
|
|
|
TtCoupon coupon = ttcouponMapper.selectById(couponId); |
|
|
|
if (null == coupon) { |
|
|
|
return new ResultData(ErrorCode.TTCOUPON_IS_EMPTY); |
|
|
|
} |
|
|
|
if (!coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_SHELFING.getCode())) { |
|
|
|
return new ResultData(ErrorCode.TTCOUPON_IS_TAKE_OFF); |
|
|
|
} |
|
|
|
if(coupon.getSalePrice() == null || coupon.getSalePrice().intValue() == 0){ |
|
|
|
return new ResultData(ErrorCode.TTCOUPON_IS_TAKE_OFF); |
|
|
|
} |
|
|
|
|
|
|
|
logger.info("OrderSave: couponId:" + couponId + "---cUserId:"+cUserId); |
|
|
|
TtCUser byId = ttCUserService.getById(cUserId, tenantEntity.getTenantId()); |
|
|
|
TtCUser byId = ttCUserService.getById(cUserId, coupon.getTenantId()); |
|
|
|
// WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(cUserId,tenantEntity.getFinalTenantId()); |
|
|
|
// if(wxCUserBasicInfo == null){ |
|
|
|
if(byId == null){ |
|
|
|
@@ -105,16 +116,7 @@ public class TtOrderServiceImpl implements TtOrderService { |
|
|
|
// logger.info("会员权益被锁定:cUserId:" + cUserId); |
|
|
|
// return new ResultData(ErrorCode.MEMBER_IS_LOCKED); |
|
|
|
// } |
|
|
|
TtCoupon coupon = ttcouponMapper.selectById(couponId); |
|
|
|
if (null == coupon) { |
|
|
|
return new ResultData(ErrorCode.TTCOUPON_IS_EMPTY); |
|
|
|
} |
|
|
|
if (!coupon.getStatus().equals(EnumTtCouponStatus.TTCOUPON_STATUS_SHELFING.getCode())) { |
|
|
|
return new ResultData(ErrorCode.TTCOUPON_IS_TAKE_OFF); |
|
|
|
} |
|
|
|
if(coupon.getSalePrice() == null || coupon.getSalePrice().intValue() == 0){ |
|
|
|
return new ResultData(ErrorCode.TTCOUPON_IS_TAKE_OFF); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
// 4.2 保存订单 |
|
|
|
@@ -122,7 +124,7 @@ public class TtOrderServiceImpl implements TtOrderService { |
|
|
|
Date now = new Date(); |
|
|
|
TtOrder order = new TtOrder(); |
|
|
|
order.setId(idWorker.nextId()); |
|
|
|
order.updateTenantInfo(tenantEntity); |
|
|
|
order.updateTenantInfo(coupon); |
|
|
|
order.setCUserId(cUserId); |
|
|
|
order.setProductId(coupon.getId()); |
|
|
|
order.setProductTitle(coupon.getTitle()); |
|
|
|
|