From d5691a0990ed1f9c07228cc6073a878358964620 Mon Sep 17 00:00:00 2001 From: yuanye Date: Mon, 22 Mar 2021 17:58:47 +0800 Subject: [PATCH] tijao --- .../main/java/com/bweb/controller/HighCouponController.java | 6 +++--- .../com/hai/service/impl/HighCouponCodeServiceImpl.java | 2 +- .../java/com/hai/service/impl/HighCouponServiceImpl.java | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java index c4c027f1..ac3ed525 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighCouponController.java @@ -174,7 +174,7 @@ public class HighCouponController { } // 查询商户 - HighMerchant merchant = highMerchantService.getMerchantById(highCoupon.getCompanyId()); + HighMerchant merchant = highMerchantService.getMerchantById(highCoupon.getMerchantId()); if (merchant == null) { log.error("HighCouponController -> updateCoupon() error!","未找到商户"); throw ErrorHelp.genException(SysCode.System, ErrorCode.MERCHANT_NOF_FOUND, ""); @@ -208,13 +208,13 @@ public class HighCouponController { throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_COUPON, ""); } // 如果卡卷状态不处于 编辑中、已下架、审上架批驳回 - if (coupon.getStatus() != 1 || coupon.getStatus() != 3 || coupon.getStatus() != 102) { + if (coupon.getStatus() != 1 && coupon.getStatus() != 3 && coupon.getStatus() != 102) { log.error("HighCouponController -> upShelfApprove() error!","卡卷状态错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_UNABLE_UP_SHELF, ""); } // 根据卡卷查询 销售码库存 - if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) <= 0) { + if (highCouponCodeService.getStockCountByCoupon(coupon.getId()) == 0) { log.error("HighCouponController -> upShelfApprove() error!","卡卷库存数量错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COUPON_STOCK_ERROR, ""); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java index 3c505b4a..3e13b7c1 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponCodeServiceImpl.java @@ -39,7 +39,7 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { @Override public Integer getStockCountByCoupon(Long couponId) { HighCouponCodeExample example = new HighCouponCodeExample(); - example.createCriteria().andStatusEqualTo(1).andSalesEndTimeLessThan(new Date()); + example.createCriteria().andCouponIdEqualTo(couponId).andStatusEqualTo(1).andSalesEndTimeLessThan(new Date()); return highCouponCodeMapper.selectByExample(example).size(); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java index ee44e081..c638eb52 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponServiceImpl.java @@ -1,5 +1,6 @@ package com.hai.service.impl; +import com.alibaba.fastjson.JSON; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; @@ -274,9 +275,7 @@ public class HighCouponServiceImpl implements HighCouponService { List coupons = highCouponMapper.selectByExample(example); if (coupons != null && coupons.size() > 0) { - List list = new ArrayList<>(); - BeanUtils.copyProperties(coupons, list); - return list; + return JSON.parseArray(JSON.toJSONString(coupons), HighCouponModel.class); } return new ArrayList<>(); }