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 31b473c1..2b78f6ee 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 eb90c8f8..d0c257ea 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; @@ -288,9 +289,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<>(); }