From d1792fa55bddcfe52c76b38cb197c7a2547ba3bf Mon Sep 17 00:00:00 2001 From: 199901012 Date: Wed, 28 Apr 2021 22:14:04 +0800 Subject: [PATCH] =?UTF-8?q?'=E4=BC=98=E5=8C=96=E5=8D=A1=E5=88=B8=E5=88=86?= =?UTF-8?q?=E9=85=8D=E9=97=AE=E9=A2=98'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hai/service/impl/HighCouponAgentServiceImpl.java | 10 ++-------- .../hai/service/impl/HighCouponCodeServiceImpl.java | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java index 6a76356f..325653f2 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighCouponAgentServiceImpl.java @@ -56,14 +56,8 @@ public class HighCouponAgentServiceImpl implements HighCouponAgentService { @Override public void assignCouponAgent(HighCouponAgentRel highCouponAgentRel,Integer stockCount) { - // 查询卡券库存数量 - Map map = new HashMap<>(); - map.put("couponId", highCouponAgentRel.getCouponId()); - map.put("status", 1); - map.put("salesEndTimeS", new Date().getTime()); - map.put("isAssignAgent", false); - - List codeList = highCouponCodeService.getCouponCodeList(map); + // 查询未销售的卡券 + List codeList = highCouponCodeService.getNoSaleCode(highCouponAgentRel.getCouponId()); if (stockCount > codeList.size()) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_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 849597ad..6a113771 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 @@ -220,7 +220,7 @@ public class HighCouponCodeServiceImpl implements HighCouponCodeService { @Override public List getNoSaleCode(Long couponId) { HighCouponCodeExample example = new HighCouponCodeExample(); - example.createCriteria().andCouponIdEqualTo(couponId).andStatusEqualTo(1).andIsAssignAgentEqualTo(false); + example.createCriteria().andCouponIdEqualTo(couponId).andStatusEqualTo(1).andIsAssignAgentEqualTo(false).andSalesEndTimeGreaterThan(new Date()); return highCouponCodeMapper.selectByExample(example); }