From 34be43345470104f79c51fc8b76569813f745d48 Mon Sep 17 00:00:00 2001 From: xhxu Date: Mon, 31 May 2021 10:57:36 +0800 Subject: [PATCH] tt --- .../iformall/service/tt/TtOrderService.java | 2 +- .../service/tt/impl/TtOrderServiceImpl.java | 28 ++++++++++--------- .../controller/TtOrderController.java | 2 +- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/service/tt/TtOrderService.java b/mallinkService/src/main/java/com/iformall/service/tt/TtOrderService.java index 9150bad5f..3e465d25b 100644 --- a/mallinkService/src/main/java/com/iformall/service/tt/TtOrderService.java +++ b/mallinkService/src/main/java/com/iformall/service/tt/TtOrderService.java @@ -27,7 +27,7 @@ public interface TtOrderService { PageInfo listAsPage(TtOrder record, Integer pageIndex, Integer pageSize); PageInfo listCAsPage(TtOrder order, Integer pageNum, Integer pageSize); - ResultData saveOrder(Long couponId, Long memberId, EnumPayWay payWay, TenantEntity tenantInfo); + ResultData saveOrder(Long couponId, Long memberId, EnumPayWay payWay); ResultData cancelOrder(Long orderId, Long memberId); diff --git a/mallinkService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java index 433905a7a..4a6cd966e 100644 --- a/mallinkService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/tt/impl/TtOrderServiceImpl.java @@ -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()); diff --git a/mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderController.java b/mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderController.java index 1a1576e5d..36c0d008f 100644 --- a/mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderController.java +++ b/mallinkTTCApi/src/main/java/com/iformall/controller/TtOrderController.java @@ -80,7 +80,7 @@ public class TtOrderController extends BaseController { } catch (MallinkException e) { return new ResultData(e.getErrorCode(), e.getMessage()); } - return ttOrderService.saveOrder(couponId,memberId,EnumPayWay.PAY_WAY_TT,getTenantInfo()); + return ttOrderService.saveOrder(couponId,memberId,EnumPayWay.PAY_WAY_TT); }